How linear system of equations can be solved in matlab

1 vue (au cours des 30 derniers jours)
Wajahat
Wajahat le 8 Sep 2018
Modifié(e) : madhan ravi le 10 Sep 2018
How we can solve following linear system of equations in matlab?
A1_{x}=1i*a*(A1+A2);
A2_{x}=1i*a*(A1-A2);
A1_{t}=(-1i*a./2)*A1-A2;
A2_{t}=A1+(1i*a./2)*A2;
where A1=A1(x,t) and A2=A2(x,t) and "a" is an arbitrary constant. How can these equations can be solved in matlab?
And A1_{x} means partial derivative of A1 w.r.t "x".
  8 commentaires
Wajahat
Wajahat le 10 Sep 2018
@Ravi, I have try to solve it symbolically, but matlab shows an error.
syms l p q
syms f1(x) f2(x)
S = dsolve(diff(f1) == l.^{-1}.*1i.*p.*f1 + l.^{-1}.*1i.*q.*f2, diff(f2) == l.^{-1}.*1i.*q.*f1 - l.^{-1}.*1i.*p.*f2);
S.f1
S.f2
Can you remove an error
Walter Roberson
Walter Roberson le 10 Sep 2018
What is the I.^{-1} intended to mean?
It is not possible to raise anything to a cell array, not unless you define your own object class and override the power() operator.

Connectez-vous pour commenter.

Réponse acceptée

madhan ravi
madhan ravi le 10 Sep 2018
Modifié(e) : madhan ravi le 10 Sep 2018
Try this @Wajahat:
syms l p q
syms f1(x) f2(x)
%edited after sir Walters comment
S1 = diff(f1) == l.^(-1).*1i.*p.*f1 + l.^(-1).*1i.*q.*f2;
S2 = diff(f2) == l.^{-1}.*1i.*q.*f1 - l.^{-1}.*1i.*p.*f2;
S = dsolve(S1,S2)
S.f2
S.f1
  1 commentaire
madhan ravi
madhan ravi le 10 Sep 2018
@Wajahat if it’s working please accept the answer

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by