Accepted Answer

The reason no plot appears is that ‘y’ is a single point, and the plot function only draws lines between pairs of points and will not plot single points (unless a marker is specified).
Your code has the most common problem I see here on Answers:
f=@(x)(2+cos(x.^2)).*exp(0.01*x)/(3*x.^2+4-x);
The division needs to be element-wise, so ‘./’ instead of ‘/’.
h=0.0001;
x=0:h:3;
f=@(x)(2+cos(x.^2)).*exp(0.01*x)./(3*x.^2+4-x);
y=f(x);
%%first derivativ
plot (x,y)
And with that correction, it works!
.

More Answers (0)

Categories

Find more on 2-D and 3-D Plots in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!