When I use ode45 to solve a state space equation, the solution will be diverge. Interestingly, if I set the ma (which I've overstriked) to zero, the result will be converge.

1 view (last 30 days)
clear
clc
xm_init = [0.09 0 0 0 0 0];
[t, xm] = ode45(@simplified_model, [0,200], xm_init);
plot(t,xm(:,1))
function dxm = simplified_model(t,xm)
kt = 1.8406e9;
kp = 1.3386e10;
ct = 5.2321e7;
cp = 2.35951e7;
It = 2.0444e9;
Ip = 3e9;
g = 9.8;
ma = 20000;
ka = 5000;
ca = 9000;
mt = 347460;
mp = 5452000;
Rt = 40;
Rp = 0.28;
Ra = 90;
M = [Ip 0 0
0 It 0
0 0 ma];
K = [kp+kt+mp*g*Rp -kt 0
-kt -mt*g*Rt+kt+ka*Ra*Ra+ma*g*Ra -ka*Ra-ma*g
0 -ka*Ra-ma*g ka];
C = [cp+ct -ct 0
-ct ct+ca*Ra*Ra -ct*Ra
0 -ct*Ra ca];
Am = zeros(6,6);
Am(1:3,4:6) =...
[1 0 0
0 1 0
0 0 1];
Am(4:6,1:3) =-M\K;
Am(4:6,4:6) =-M\C;
xm = [xm(1) xm(2) xm(3) xm(4) xm(5) xm(6)]';
dxm = Am*xm;
end

Accepted Answer

David Goodmanson
David Goodmanson on 17 Dec 2024
Edited: David Goodmanson on 17 Dec 2024
Hi Z^2,
It's not easy to say for sure without seeing the actual model, but I think there is a decent chance that your C matrix should not be
C = [cp+ct -ct 0
-ct ct+ca*Ra*Ra -ct*Ra
0 -ct*Ra ca];
but rather
C = [cp+ct -ct 0
-ct ct+ca*Ra*Ra -ca*Ra
0 -ca*Ra ca];
i.e. the (2,3) and (3,2) elements go from ct to ca. That change produces the following plot:

More Answers (0)

Tags

Products


Release

R2022b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!