Plotting two equations on matlab

104 visualizaciones (últimos 30 días)
Anna Gilchrist
Anna Gilchrist el 22 de Abr. de 2020
Comentada: darova el 22 de Abr. de 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

Respuesta aceptada

Christian Metz
Christian Metz el 22 de Abr. de 2020
Editada: Christian Metz el 22 de Abr. de 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)
  2 comentarios
Anna Gilchrist
Anna Gilchrist el 22 de Abr. de 2020
thank you
darova
darova el 22 de Abr. de 2020

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by