Plotting two equations on matlab

36 ビュー (過去 30 日間)
Anna Gilchrist
Anna Gilchrist 2020 年 4 月 22 日
コメント済み: darova 2020 年 4 月 22 日
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)
  2 件のコメント
Anna Gilchrist
Anna Gilchrist 2020 年 4 月 22 日
thank you
darova
darova 2020 年 4 月 22 日

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File Exchange2-D and 3-D Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by