필터 지우기
필터 지우기

Problem with plotting a function on a specified domain

조회 수: 1 (최근 30일)
Cris19
Cris19 2018년 6월 10일
댓글: Ameer Hamza 2018년 6월 10일
I am trying to plot the solution of a system of ODEs. The code is:
tspan = [0 10];
z0 = [0.01 0.01 0.01 0.01];
[t,z] = ode45(@(t,z) odefun3(t,z), tspan, z0);
plot(z(:,3))
Why the output is plotted on the interval [0,60] and not on [0,10], as in the code ?

채택된 답변

Ameer Hamza
Ameer Hamza 2018년 6월 10일
You also need to specify x variable for plot. Try
plot(t, z(:,3))
  댓글 수: 2
Cris19
Cris19 2018년 6월 10일
Indeed with the command (t, z(:,3)) it worked. Thank you !
Ameer Hamza
Ameer Hamza 2018년 6월 10일
You are welcome.

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by