Filter löschen
Filter löschen

Matlab dsolve issue with simple equations

9 Ansichten (letzte 30 Tage)
Ahmed Khamis
Ahmed Khamis am 19 Sep. 2023
Beantwortet: SAI SRUJAN am 9 Okt. 2023
I am trying to solve simple equations as:
syms e1(t) e2(t) f1(t) f2(t) R1 C1
Vc_dot=diff(e2);
cond=[Vc_dot(0)==0]
cond = 
eqns = [e1 == e2; f2 == C1*Vc_dot; f1 == f2]
eqns(t) = 
S=dsolve(eqns,cond)
Error using symengine
Invalid equation or initial condition.

Error in mupadengine/evalin_internal

Error in mupadengine/fevalHelper

Error in mupadengine/feval_internal

Error in dsolve>mupadDsolve (line 334)
T = feval_internal(symengine,'symobj::dsolve',sys,x,options);

Error in dsolve (line 203)
sol = mupadDsolve(args, options);
I am getting this error although equations are trivial
  1 Kommentar
Torsten
Torsten am 19 Sep. 2023
Bearbeitet: Torsten am 19 Sep. 2023
"dsolve" accepts differential systems of equations, not differential-algebraic systems as in your case.
And I'm not sure what you expect as solution.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

SAI SRUJAN
SAI SRUJAN am 9 Okt. 2023
Hi Ahmed Khamis,
I can understand that you are facing an issue using the "dsolve" MATLAB function.
You encountered this error as "dsolve" only accepts differential system of equations. Line 4 of your code is causing the error as the equations are not all differential system of equations.
You can follow the below given example to resolve the issue.
syms e(t) e1(t) e2(t) c
eqn1=[diff(e,t)==e*c];
S=dsolve(eqn1);
The above code will exceute as the "eqn1" contains only differential set of equations.
eqn2=[e1==e2 ,diff(e,t)==e*c];
S=dsolve(eqn2);
The above code snippet errors out as the all the equations in "eqn2" are not differential set of equations.
You can refer to the below documentation to understand more about "dsolve" function in MATLAB.

Produkte


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by