Reputation: 58
I'm trying to plot a function that is in a separate .m file:
function V = Vitesse_Glissade(x, Courbe)
%some code
end
x is a variable evaluated between 0 and 25, but Courbe is a 4th order polinomial in the form of a vector that the function uses.
I have tried this but it doesn't work:
figure
fplot(@(x) 'Vitesse_Glissade',[0 25], Courbe);
I get this error message:
Error using /
Matrix dimensions must agree.
Error in fplot (line 96)
maxstep = (xmax - xmin) / N;
Error in Glissage (line 37)
fplot(@(x) 'Vitesse_Glissade',[0 25], Courbe);
I have looked at posts where for multiple variable input in fplot, but since I use a vector as a parameter, it's different.
Thanks in advance!
Upvotes: 0
Views: 135
Reputation: 60504
This is not how function handles work. Use this syntax instead:
fplot(@(x)Vitesse_Glissade(x,Courbe),[0 25]);
Upvotes: 1