How to create a function in the editor, then evaluate the function and plot the function.
Mostrar comentarios más antiguos
Hello all,
I am typing this function into the editor, and my goal is to evaluate the function at some points, and plot the function. Here is what I am typing in the editor.
function anon1
f=@(x) x^3 + 2x^2 - x
a=-10;
b=10;
TOL=.001
So, to evaluate the function at x=3 what do I type in the command window? And how do I apply the form given to plot. The form is fplot(fun,limits).
I was under the impression that I could just type anon1(3) to evaluate, but an error is showing.
Thanks
Respuesta aceptada
Más respuestas (1)
Azzi Abdelmalek
el 13 de Feb. de 2013
Editada: Azzi Abdelmalek
el 13 de Feb. de 2013
f(3)
to plot
f=@(x)x^3 + 2*x^2 - x
a=-10;
b=10;
fplot(f,[a,b])
1 comentario
Truxton
el 13 de Feb. de 2013
Categorías
Más información sobre MATLAB en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!