MATLAB: Integration variable inside interpolation function

integrationinterpolationlinear interpolationMATLABnumerical integration

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 !!

Best Answer

Why do it by symbolic computation at all? Why not just use integral() or trapz()?