필터 지우기
필터 지우기

Solve a nonlinear differential system

조회 수: 1 (최근 30일)
Rahiti Arapari Hargous
Rahiti Arapari Hargous 2018년 7월 31일
댓글: Rahiti Arapari Hargous 2018년 8월 6일
Hi everyone,
I have problem to plot the next system for the use of an ode45. The two functions are y(t) and x(t) with "t" the variable. The system of equation is the next one:
ay''' - b*x*y' + w*cos(y) = 0
x' - w*L*sin(y)=0
a,b,w and L are constant
If anyone can help thanks a lot for your time.

답변 (1개)

Areej Varamban Kallan
Areej Varamban Kallan 2018년 8월 3일
Hi Rahiti,
I understand that you need help in solving nonlinear system of differential equations using 'ode45'. To use 'ode45' the governing equations should be of the form X' = F(X,t), where X and F are vectors. Your system of equations can be recast into this form as follows:
  1. Let x1 = x and x2 = y
  2. x1' = wLsin(x2)
  3. x2' = x3
  4. x3' = x4
  5. x4' = (bx1x3-wcos(x2))/a
Define these derivatives in a separate function file (func.m) and pass its handle as an argument to ode45.
function dxdt=func(t,x)
a=1;
b=0.2;
w=1;
L=0.1;
dx1dt=w*L*sin(x(2));
dx2dt=x(3);
dx3dt=x(4);
dx4dt=(b*x(1)*x(3)-w*cos(x(2)))/a;
dxdt=[dx1dt;dx2dt;dx3dt;dx4dt];
end
A sample execution is shown below
tspan = [0 5] % time interval in which equations are solved
X0 = [1 1 0 0] % initial values of x1, x2 , x3 and x4 (or x, y, y', y'')
[t,X]=ode45(@func,tspan, X0)

카테고리

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