Effacer les filtres
Effacer les filtres

Matlab dsolve issue with simple equations

9 vues (au cours des 30 derniers jours)
Ahmed Khamis
Ahmed Khamis le 19 Sep 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 commentaire
Torsten
Torsten le 19 Sep 2023
Modifié(e) : Torsten le 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.

Connectez-vous pour commenter.

Réponses (1)

SAI SRUJAN
SAI SRUJAN le 9 Oct 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.

Produits


Version

R2023a

Community Treasure Hunt

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

Start Hunting!

Translated by