Solving a System of 2nd Order Nonlinear ODEs
Show older comments
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

Accepted Answer
More Answers (1)
Alan Stevens
on 3 Apr 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.
Categories
Find more on Ordinary Differential Equations in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




