フィルターのクリア

Solve a nonlinear differential system

1 回表示 (過去 30 日間)
Rahiti Arapari Hargous
Rahiti Arapari Hargous 2018 年 7 月 31 日
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)
  1 件のコメント
Rahiti Arapari Hargous
Rahiti Arapari Hargous 2018 年 8 月 6 日
Thanks a lot for you help

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeOrdinary Differential Equations についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by