I have created an anonymous function
sqr = @(x) x.^2;
and I am trying different methods for plotting this function, and none seem to plot the function correctly (aside from ezplot) I have tried
figureplot(sqr(-5:5))figurefplot(sqr(-5:5))
Using plot(), it creates a correct looking plot but my axes are not correct, it displays the function from 1 to 11, centered at 6. (so the range is correct)
using fplot() it creates horizontal lines from x = -5:5 at y = 0, 2, 4, 9, 16, 25
Is this what is supposed to happen and I just don't fully understand the functions yet? Or have I set my function up incorrectly?
Thanks.
Best Answer