ODE45 Why does my outcome change with the sequence of my equations?

조회 수: 2 (최근 30일)
Iris Heemskerk
Iris Heemskerk 2020년 4월 18일
댓글: Star Strider 2020년 4월 18일
I am writing a code to simulate a system. It came to my attention that when I change the sequence of my differential equations, the outcomes change. Can anyone explain to me why this happens and if this is an error in my code or a mathematical phemonon? Now I do not know if my outcomes are correct.
Thank you so much for your help!
close all;
clear all;
ds = 18.32
ws = 45
br = 0.0015
bd = 0.0015
rho = 1019
g = 9.81
massvessel = ds * ws * rho
wd = 1.13
syms u1(t) u2(t) ud(t) us(t) wr(t) h(t) T Y
u1(t) == (-us * ds + wr(t) * u2(t))/wr(t);
u2(t) == (us*ds + wr(t)* u1(t))/wr(t);
ud(t) == -(u2(t)*wr(t))/wd;
as(t) = -0.5 * (((h(t))^2)*rho*g)/massvessel;
Eqns = [diff(u1(t),t) == g*(h(t)/ds) - br * (u1(t));
diff(u2(t),t) == -g * (h(t)/ds) - br * (u2(t));
diff(ud(t),t) == -g * (h(t)/ws) - bd * (ud(t));
diff(us(t),t) == as(t);
diff(wr(t),t) == us;
diff(h(t),t) == - u1(t)];
[DEsys,Subs] = odeToVectorField(Eqns);
DEfcn = matlabFunction(DEsys, 'Vars',{T,Y});
tspan = linspace(0, 400, 401);
Y0 = [0.067526; 0; 0; 0; 30; 0]+0.001;
[T, Y] = ode45(DEfcn, tspan, Y0);

답변 (0개)

카테고리

Help CenterFile Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by