Numerically solving a system of equations, both differential and not
조회 수: 3 (최근 30일)
이전 댓글 표시
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
채택된 답변
Jan
2013년 3월 16일
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
추가 답변 (1개)
Azzi Abdelmalek
2013년 3월 16일
편집: Azzi Abdelmalek
2013년 3월 16일
댓글 수: 3
Azzi Abdelmalek
2013년 3월 16일
To solve dif equation use ode function (ode45,...)
To solve system of nonlinear equations use fsolve
참고 항목
카테고리
Help Center 및 File Exchange에서 Ordinary Differential Equations에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!