フィルターのクリア

transform ode15i input to ode15s input

3 ビュー (過去 30 日間)
Jan Filip
Jan Filip 2021 年 3 月 4 日
回答済み: Ganesh 2024 年 5 月 30 日
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)

回答 (1 件)

Ganesh
Ganesh 2024 年 5 月 30 日
Hi there,
It looks like you're aiming to adapt a system for the "ode15s" solver, which requires a different formulation compared to "ode15i". The key difference lies in how each solver expects the equations to be structured. While "ode15i" handles implicit forms directly, "ode15s" needs them in a specific mass matrix format.
To rewrite your equations for "ode15s", you'll have to separate the differential components from the algebraic ones, arranging them into a mass matrix "M(t, y)" and a function "f(t, y)", respectively. This is because "ode15s" operates on the principle "M(t, y)*y' = f(t, y)", where M is the mass matrix and f represents your system of equations without the derivatives.
The below steps can help you resolve your issue:
1. Construct the Mass Matrix M(t, y): This matrix is pivotal for "ode15s". It should be structured such that equations involving derivatives correspond to non-zero entries in \(M\).
2. Isolate Derivatives to One Side: Make sure all your derivatives y' are on one side of the equation. This will help clarify which parts belong to the mass matrix and which to the function \(f\).
3. Define the Function f(t, y):This includes everything that's not a derivative — essentially, the right side of your system once you've isolated y'.
For your specific system, you'll need to manually work through each equation to build both "M" and "f". This process ensures that "ode15s" can interpret and solve your DAEs efficiently.
For additional guidance on using "ode15s" and structuring your equations appropriately, you might find this MATLAB documentation page helpful:
I hope this helps!

カテゴリ

Help Center および File ExchangeSymbolic Math Toolbox についてさらに検索

タグ

製品


リリース

R2020a

Community Treasure Hunt

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

Start Hunting!

Translated by