Plotting system of differential equations

조회 수: 23 (최근 30일)
Sajith Dharmasena
Sajith Dharmasena 2015년 3월 24일
댓글: Star Strider 2015년 3월 24일
Hi,
does anybody know the code to plot a system of differential equations? For example say,
x1(dot) = -x2 + (x1)^2 -(x1*x2)
x2(dot) = x1 + (x1*x2)
Thanks in advance! :)
Sajith.

채택된 답변

Star Strider
Star Strider 2015년 3월 24일
Yes.
Use ode45 to integrate your equations, then plot the solution.
Give it a go. It should be very easy for you to cast your system of equations as an Anonymous Function. If you have problems with your code, we can help you get it running.
  댓글 수: 5
Sajith Dharmasena
Sajith Dharmasena 2015년 3월 24일
How do you plot x1 vs x2? (phase plane)
Star Strider
Star Strider 2015년 3월 24일
You plot just that:
plot(x(:,1), x(:,2))

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Programming에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by