How can I graph a "system" of ODEs?

조회 수: 2 (최근 30일)
Michael
Michael 2012년 7월 5일
I am trying to model a shape that is defined with multiple differential equations. For reference, the variables are x and y (from the normal Cartesian plane) and then S (arc length) and theta (angle of the arc length with the horizontal).
The equations are:
dtheta/dS = -sin(theta)/x + y - 2H (a constant)
dx/dS = cos(theta)
dy/dS = sin(theta)
I'm just wondering if MatLab has an easy way to do this. If not, how could I set up a modified Euler's Method to solve this?
  댓글 수: 2
Star Strider
Star Strider 2012년 7월 5일
If you haven’t already, see:
to start with.
Michael
Michael 2012년 8월 8일
Seen it. Didn't really help me. I've used ode45 on a 2nd order ODE, but have never used these with systems.

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

채택된 답변

Star Strider
Star Strider 2012년 8월 8일
편집: Star Strider 2012년 8월 8일
Is this what you want to do?
% dThXYdS(1) = theta(S), dThXYdS(2) = x(S), dThXYdS(3) = y(S)
H = 10;
dThXYdS = @(t,XYTh) [-sin(XThXY(1))/ThXY(2) + ThXY(3) - 2*H; cos(ThXY(1)); sin(XYTh(1))];
x0 = [0.1; 0.1; 0];
Tspan = [0:0.01:2]';
[T ThXY] = ode45(dThXYdS, Tspan, x0);
figure(8)
plot3(ThXY(:,1), ThXY(:,2), ThXY(:,3))
xlabel('X(S)')
ylabel('Y(S)')
zlabel('\Theta(S)')
grid
I have no idea what you intend for H or the rest, but this seems to work. I named the variable ThXY to denote the vector as [Theta(S); X(S); Y(S)].

추가 답변 (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