transform ode15i input to ode15s input

1 view (last 30 days)
Jan Filip
Jan Filip on 4 Mar 2021
Since I got completely stuck in the last two weeks I am giving up with ode15i solver and I would like to solve my equations using ode15s.
But input formulations of DAE for ode15s are completely different from those used in ode15i.
Is there some method to rewrite systems like the one below programatically for ode15s solver?
syms u1(t) u2(t) u3(t) u4(t) u5(t) il1(t) il2(t) iv1(t) L1 L2 C1 C2 C3 G1 G2 V1 I1
x = [u1(t) u2(t) u3(t) u4(t) u5(t) il1(t) il2(t) iv1(t)].'
eqns = [
iv1(t) - il1(t) == 0
il1(t) - tanh(100*t)*sin(3000*pi*t) + diff(u2(t), t)/10000000000 - (7737125245533627*diff(u3(t), t))/154742504910672534362390528 == 0
(7737125245533627*diff(u3(t), t))/154742504910672534362390528 - (7737125245533627*diff(u2(t), t))/154742504910672534362390528 - il2(t) == 0
il2(t) + u4(t)/50 + tanh(100*t)*sin(3000*pi*t) + (7737125245533627*diff(u4(t), t))/154742504910672534362390528 - (7737125245533627*diff(u5(t), t))/154742504910672534362390528 == 0
u5(t)/50 - (7737125245533627*diff(u4(t), t))/154742504910672534362390528 + (7737125245533627*diff(u5(t), t))/154742504910672534362390528 == 0
u1(t) - u2(t) + diff(il1(t), t)/10000000 == 0
u3(t) - u4(t) + diff(il2(t), t)/10000000 == 0
u1(t) - sin(2000*pi*t) == 0]
f = daeFunction(eqns,x)
F = @(t,Y,YP) f(t,Y,YP);
y0est = [0 0 0 0 0 0 0 0]';
yp0est = [0 0 0 0 0 0 0 0]';
opt = odeset('RelTol', 1e-3,'AbsTol',1e-3);
[y0,yp0] = decic(F,0,y0est,[],yp0est,[],opt)
[tSol,ySol] = ode15i(F,[0:1e-6:0.1],y0,yp0,opt);
plot(tSol,ySol)

Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Products


Release

R2020a

Community Treasure Hunt

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

Start Hunting!