Solving a second order differential equations with multi variables using "MASS" function in odeset by ODE45
13 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello to anyone who's reading this!
I'm trying to solve a set of second order differential equations using ode45, but when I change my ICs a little bit I get this error "Warning: Matrix is close to singular or badly scaled. Results may be inaccurate" . obviously my Mass matrix is not usable by MATLAB. I'd like to know how can I fix this ? I'd rather stay using ode45 if possible.
function [ m ] = Mass( t,q )
M0 = 2; M1 = 1; M2 = 1;
g = 1;
l1= 1; l2 = 1;
m1 = [ 1 0 0 0 0 0 ];
m2 = [ 0 (M0+M1+M2) 0 -M1*l1*cosd(q(3)) 0 -M2*l2*cosd(q(5)) ];
m3 = [ 0 0 1 0 0 0 ];
m4 = [ 0 -M1*l1*cosd(q(3)) 0 M1*(l1.^2) 0 0 ];
m5 = [ 0 0 0 0 1 0];
m6 = [ 0 -M2*l2*cosd(q(5)) 0 0 0 M2*(l2.^2) ];
m = [m1;m2;m3;m4;m5;m6];
end
clear all;close all;clc;
tspan = [0 40];
q0 = [ 0 0 -90.01 0 90 0 ];
options = odeset('MASS',@Mass);
[t,q] =ode45(@State_F,tspan,q0,options);
So this happens when q0(3) ~ -90 and q0(5) ~ 90. It perfectly works when They're around smaller numbers such as 10-20-25. I have checked the mathematics couple of times. If you still believe something is wrong with the mathematics as well please let me know. I really appreciate you taking the time!
0 comentarios
Respuestas (2)
Ebraheem Menda
el 3 de En. de 2018
One more thing is you did not give the 2nd order diff. equation.
0 comentarios
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!