Solving a System of 2nd Order Nonlinear ODEs
Afficher commentaires plus anciens
Hi, I need help with setting up the code for the below 2 non-linear differential equations. I do not have symbolic toolbox. Below is how I tried it but didn't work. Any help will be appreciated.
clear all;clc
function dydt=mbd(M,m,g,lc,k)
y1=y(1);
y2=y(2);
z1=z(1); %z1
z2=z(2); %z2
y5=(1/(M+m))*((m*l/2)*(sin(z(1)))*y6 + (m*l/2)*(cos(z(1)))*(z(2))^2 ...
-c*y(2)-k*y(1));
y6=(3/(m*l^2))*((m*l/2)*(sin(z(1)))*y5 - (m*g*l/2)*(sin(z(1))));
dydt=[y1;y2;y3;y4;y5;y6];
end

Réponse acceptée
Plus de réponses (1)
Alan Stevens
le 3 Avr 2022
You haven't passed y and z to the funcion in
function dydt=mbd(M,m,g,lc,k)
Probably needs to be more like
function dydt=mbd(t,y,z,M,m,g,lc,k)
with the calling function modified accordingly.
Catégories
En savoir plus sur Ordinary Differential Equations dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!





