Réponse acceptée

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!
.

2 commentaires

Aktaruzzaman shuvo
Aktaruzzaman shuvo le 1 Mai 2022
thank you so much @Star Strider
Star Strider
Star Strider le 1 Mai 2022
As always, my pleasure!

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur 2-D and 3-D Plots dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by