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 CenterFile Exchange에서 2-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