- Please don't post an answer just to thank the person who answered your question.
- DO learn to use comments.
- And don't accept your own non-answer.
How to solve differential equations while variables are coupled?
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Md Bellal Hossain
le 15 Mai 2020
Modifié(e) : John D'Errico
le 30 Mai 2020
(p-1)*U1r-d(U1i)/dx+L*U2r-n*d^2(U1r)/dx^2=0;
(p+1)*U1i+d(U1r)/dx+L*U2i+n*d^2(U1i)/dx^2=0;
(p-1)*U2r-d(U2i)/dx+L*U1r=0;
(p+1)*U2i+d(U2r)/dx+L*U1i=0.
How to solve U1r, U1i, U2r, and U2i by using MATLAB symlbolic tool ?
Thanks in advance.
1 commentaire
John D'Errico
le 30 Mai 2020
Modifié(e) : John D'Errico
le 30 Mai 2020
I've unaccepted your non-answer, and accepted Ameer's answer for you.
Réponse acceptée
Ameer Hamza
le 15 Mai 2020
Try this code.
syms U1r(t) U1i(t) U2r(t) U2i(t) p n L
eq1 = (p-1)*U1r - diff(U1i) + L*U2r - n*diff(U1r,2) == 0;
eq2 = (p+1)*U1i + diff(U1r) + L*U2i + n*diff(U1i,2) == 0;
eq3 = (p-1)*U2r - diff(U2i) + L*U1r == 0;
eq4 = (p+1)*U2i + diff(U2r) + L*U1i == 0;
eq = [eq1; eq2; eq3; eq4];
cond = [U1r(0)==0 U1i(0)==0 U2r(0)==0 U2i(0)==0];
sol = dsolve(eq, 'IgnoreAnalyticConstraints', true, 'MaxDegree', 4)
However, the analytical solution is a "bit" messy. Following is output of Live script.
disp(sol.U1r)
disp(sol.U1i)
disp(sol.U2r)
disp(sol.U2i)
I recommend using a numerical method.
6 commentaires
Ameer Hamza
le 30 Mai 2020
Run this code in Live script. I guess live script was introduced somewhere near R2017.
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!