Effacer les filtres
Effacer les filtres

Graph an exponential equation

4 vues (au cours des 30 derniers jours)
Trang To
Trang To le 8 Déc 2020
Commenté : Trang To le 8 Déc 2020
Please help me graph this equation
  2 commentaires
Ive J
Ive J le 8 Déc 2020
What have you tried so far?
Trang To
Trang To le 8 Déc 2020
x = linspace(0,2*pi,100);
y = exp(1)^(-0.005*x).*cos(0.05*(2000-0.01*x^2)^(0.05))-0.01;
plot(x,y)
I have some error with this

Connectez-vous pour commenter.

Réponse acceptée

Ameer Hamza
Ameer Hamza le 8 Déc 2020
Modifié(e) : Ameer Hamza le 8 Déc 2020
You can use fsolve() for such problems. For example
fun = @(x) exp(-0.005*x).*cos(0.05*(2000-0.01*x.^2).^(0.05))-0.01
sol = fsolve(fun, rand())
Note that, the code you included in your question contain exp(1)^(-0.005*x). That is very inefficient.
If you just want to graph it then try
x = linspace(0,2*pi,100);
y = exp(-0.005*x).*cos(0.05*(2000-0.01*x.^2).^(0.05))-0.01;
plot(x,y)
Note that I have replaced * with .* and ^ with .^. Read about element-wise operators here: https://www.mathworks.com/help/matlab/matlab_prog/array-vs-matrix-operations.html
  1 commentaire
Trang To
Trang To le 8 Déc 2020
thank you so much

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Construction 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!

Translated by