Numerically solving a system of equations, both differential and not
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
I have a system of differential equations, all of the type:
dV1/dt=(Pa-Pb)/Ra-(Pb-Pc)/Rb
The R's are constants, but the P's are also variables, and linked through non-differential equations.
I was able to extract most of them and plug in equations using only constants and V's, but some have complex enough equations that it seems no analytical solution is possible.
I've tried to use ODE45, since I was told it could handle a system of equations that included non-differential equations, but it stops on the first variable that hasn't been defined. A simplified version would be:
I started from:
dVdt(1,1)=((Prv-P1)/Ra)-((P2-P3)/Rb); dVdt(2,1)=((P3-Plv)/Rb)-((Plv-P4)/Rc); ...etc
I now have expressions for P1,P2. and Ra,Rb... are constants. But Prv and Plv are connected through several equations (some containing a V variable) and other variables.
For example: (this is very simplified)
Rrv=Pr+Vspt Pl=A*V(1)+B*exp(C*Vspt) ...etc
All together, I have as many equations as variables, but when I tried to get analytical solutions for those non-differential equations so I could plug them in instead of Plv and Prv, it didn't work.
When I try to run ODE45 with all of these equations together, it gives me an error message on the first variable, in this case Vspt.
Is there a way to get ODE45 to treat the non-differential equations as part of the system, and give me a numeric solution for the whole? Or is there another function that would be able to do it?
dsolve doesn't seem to be able to handle this, probably because the lack of an analytical solution.
Thank you!
0 Kommentare
Akzeptierte Antwort
Jan
am 16 Mär. 2013
It sounds like you want to solve a DAE, a differential algebraic system, or in other words, an ODE with algebraic constraints. To get more information, type:
docsearch dae
Weitere Antworten (1)
Azzi Abdelmalek
am 16 Mär. 2013
Bearbeitet: Azzi Abdelmalek
am 16 Mär. 2013
3 Kommentare
Azzi Abdelmalek
am 16 Mär. 2013
To solve dif equation use ode function (ode45,...)
To solve system of nonlinear equations use fsolve
Siehe auch
Kategorien
Mehr zu Ordinary Differential Equations finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!