Plotting two equations on matlab

8 次查看(过去 30 天)
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

采纳的回答

Christian Metz
Christian Metz 2020-4-22
编辑:Christian Metz 2020-4-22
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)

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Line Plots 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by