Plotting two equations on matlab
105 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Anna Gilchrist
le 22 Avr 2020
Commenté : darova
le 22 Avr 2020
I am trying to plot these two equations on the same graph but it just comes out blank and I can't work out why.
I originally wanted to plot u=3.*exp(t).*[1;1] + exp(-t).*[1;-1] as two seperate lines but I couldn't work out how to do that either
for t = [0:0.1:2];
ua= 3.*exp(t)+exp(-t);
ub= 3.*exp(t)-exp(-t);
plot(t,ua)
hold on
plot(t,ub)
end
0 commentaires
Réponse acceptée
Christian Metz
le 22 Avr 2020
Modifié(e) : Christian Metz
le 22 Avr 2020
Just plot it not in a loop. Create t before and then run the code
t = [0:0.1:2];
ua= 3.*exp(t)+exp(-t);
ub= 3.*exp(t)-exp(-t);
plot(t,ua)
hold on
plot(t,ub)
Plus de réponses (0)
Voir également
Catégories
En savoir plus sur Annotations 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!