The explicit problem is as follows: Write a function and use the fplot command to plot f(x)=x^3-x+8 versus x, for values of x from 0 to 100.
The easy way, throw the following code into matlab and call it a day:
Testing = @(x) x^3 - x + 8
fplot(Testing, [0 100])
and done!
but I want to take a slightly more 'difficult' approach. Basically I made a seperate .m file that has the following:
function [y] = blah(x)
y = (x^3) - x + 8;
end
and a script with the following
fplot('blah', [0 100])
but it doesn't work. whyyyy ( i keep getting a positive-sloped line)
Thanks!
@with your call to that function. See the duplicate target and gnovice's comment on the accepted answer