Azzera filtri
Azzera filtri

Matlab dsolve issue with simple equations

9 visualizzazioni (ultimi 30 giorni)
Ahmed Khamis
Ahmed Khamis il 19 Set 2023
Risposto: SAI SRUJAN il 9 Ott 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 Commento
Torsten
Torsten il 19 Set 2023
Modificato: Torsten il 19 Set 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.

Accedi per commentare.

Risposte (1)

SAI SRUJAN
SAI SRUJAN il 9 Ott 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.

Prodotti


Release

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by