How to plot f: y=e^-x.sin^2x function in matlab?
32 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Lenka Labikova
le 17 Nov 2020
Commenté : Lenka Labikova
le 18 Nov 2020
f: y=e^-x.sin^2x
Please help my computer gives errors and I don't know how to fix them.
0 commentaires
Réponse acceptée
Setsuna Yuuki.
le 17 Nov 2020
Modifié(e) : Setsuna Yuuki.
le 17 Nov 2020
You should try this
x = 0:1e-3:10
y=exp(-x).*sin(x).^2;
plot(x,y)
Plus de réponses (1)
Adam Danz
le 17 Nov 2020
Modifié(e) : Adam Danz
le 17 Nov 2020
Errors to fix (numbers refer to the characters above the numbers)
f: y=e^-x.sin^2x
% 1 2 34 5
- f: is not valid matlab syntax. You mean f=
- if e is a variable, this is OK but if you're looking for exponent, use exp(-x)
- x.sin is not valid matlab syntax. If you want multiplication, use x*sin (see next point)
- if 'sin' is a variable, then sin^2 is ok but it's a horrible variable name. If you want to use the sin function, use sin(__)
- 2x is not valid matlab syntax. Use 2*x if x is a scalar or 2.*x if x is an array. Or, sin(x)^2
0 commentaires
Voir également
Catégories
En savoir plus sur Graphics Objects dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!