t**i 发帖数: 511 | 1 I want to use linear interpolation to make a function f, then intergrate it,
but matlab says that it is a variable, for example, the code is:
a=[1,2,9,20];
b=[2.5,3.4,4.5,4.8];
f=@(c) interp1(a,b,c,'linear');
% intergate f from 1 to 20
quad(@f,1,20)
the error is:
"f" was previously used as a variable,
conflicting with its use here as the name of a function or command.
求教:怎么才能改进,让f变为function,而不是variable?
Thanks a lot for your answering! |
|