Integration variable inside interpolation function

Hi all,
I wish to perform an integration as indicated below.
I am facing an error because the I am using the integration variable 'u' inside interpolation function. (If I replace 'u' inside interpolation function by some constant, the integration runs fine.)
>> syms u
>> double(int(2*interp1(x,y,u),u,0,0.1))
Error using interp1>Interp1D (line 330)
Inputs must be floats, namely single or double.
Error in interp1 (line 220)
Vq = Interp1D(X,V,Xq,method);
Can you please provide some pointers to fix it.
P.S.: For clarification, y=f(x) [piecewise function] which is why I am interpolating to determine intermediate values.
Thanks a lot !!

 Accepted Answer

Matt J
Matt J on 1 Dec 2013
Edited: Matt J on 1 Dec 2013
Why do it by symbolic computation at all? Why not just use integral() or trapz()?

More Answers (0)

Products

Asked:

on 1 Dec 2013

Edited:

on 1 Dec 2013

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!