Got Questions? Get Answers.
Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
ode23 not converging

Subject: ode23 not converging

From: Windell

Date: 19 Nov, 2009 06:23:02

Message: 1 of 1


I have written a short MATLAB program that calculates the kinematics and dynamics of a satellite with a feedback control loop. The equations I know for sure are correct as they were given to me to simulate the motion of the satellite. However, when I use ode23 to solve them, MATLAB runs and runs without the ode23 converging. Any suggestions to see where I could have gone wrong? Here is my code.

%define some initial conditions.
%orbital insertion tumbling angular velocity.
%initial orientation of the satellite's antenna vector in the LVLH frame.
Gamma=[0 1 0];
%set to analyze the model for 100s.
%solve differtial eqns.
[t,z]=ode23('diffeqs2',[t0 tf],[Omega_BI Gamma]);

function q=diff_eqs(t,x)
%define needed unit vectors.
e1=[1 0 0]';
e3=[0 0 1]';
%create skew symmetric matrix of e3 unit vector.
e3cross=[0 -1 0;1 0 0;0 0 0];
%satellite intertial matrix. (kg-m^2)
%satellite orbital angular velocity (rad/s)
%define initial orientation of satellite in orbit wrt
%intertial coordinate frame
%define a positive scalar kp.

%assign the inputs.
Omega_BI=[x(1) x(2) x(3)]';
Gamma=[x(4) x(5) x(6)]';

%define the diff equations.
dotOmega_BI= inv(J)*(cross(J*Omega_BI,Omega_BI)+ u);
q=[dotOmega_BI; dotGamma];

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us