# Thread: m file failure?

1. Originally Posted by ramdrop
I got a very nice plot, thanks, so I guess I do the same for the next part of the file?
As it happens you don't need to, at the command prompt now type:

Code:
>>plot(x,(f(x+0.1)-f(x))/0.1,'r')
>>plot(x,(f(x+0.01)-f(x))/0.01,'g')
>>plot(x,(f(x+0.001)-f(x))/0.001,'b')
>>plot(x,(f(x+0.0001)-f(x))/0.0001,'m')
If you want them on the same plot you will need

Code:
>>hold on
before hand, (and sort out axes)

CB

2. But what about the derivative? Im trying to differentiate the function, maybe its not being shown as well because the original is $e^x$

If it was for say, $x^2$:

function [y]=f(x)
y=exp(x);

then...

>>x=[-10:0.5:10]
>>y=f(x)
>>plot(x,y);
then, i want to plot the derivative, and approximate it... using the values of x = 0.01, 0.001.. .etc, so the fd(x) is needed.

3. Originally Posted by ramdrop
But what about the derivative? Im trying to differentiate the function, maybe its not being shown as well because the original is $e^x$

If it was for say, $x^2$:

then...

then, i want to plot the derivative, and approximate it... using the values of x = 0.01, 0.001.. .etc, so the fd(x) is needed.
Reread my last post

CB

4. Thats my fault lol :P I under quite a bit of pressure today :f

But thanks, it works just like i wanted it too.

With the titles + axis labels, i just type them @ command promt or place them in the f file?

Page 2 of 2 First 12