- Let x1 = x and x2 = y
- x1' = wLsin(x2)
- x2' = x3
- x3' = x4
- x4' = (bx1x3-wcos(x2))/a
Solve a nonlinear differential system
1 visualización (últimos 30 días)
Mostrar comentarios más antiguos
Rahiti Arapari Hargous
el 31 de Jul. de 2018
Comentada: Rahiti Arapari Hargous
el 6 de Ag. de 2018
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.
0 comentarios
Respuestas (1)
Areej Varamban Kallan
el 3 de Ag. de 2018
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:
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)
Refer to the documentation https://www.mathworks.com/help/releases/R2018a/matlab/ref/ode45.html for more details.
Ver también
Categorías
Más información sobre Ordinary Differential Equations en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!