Clear Filters
Clear Filters

issue with solving system of odes in matlab

2 views (last 30 days)
syms l g t A omg k
syms f1(x) f2(x)
S = dsolve(diff(f1) == l*f1 + sqrt(g)*A*exp(i*omg*t-i*k*x)*f2, diff(f2) == -sqrt(g)*A*exp(-i*omg*t+i*k*x)*f1 -l*f2)
S.f1
S.f2
matlab shows error when i solve the above mentioned ode in matlab, is there anyone who can guide me to remove the error.

Accepted Answer

Walter Roberson
Walter Roberson on 5 Oct 2017
Edited: Walter Roberson on 24 Jan 2018
MATLAB is not powerful enough to solve that analytically. Maple says that the solution is
f1(x) = -(1/2)*exp(1i*omg*t)*(C2*(1i*k-(-k^2-4*A^2*g+(4i)*k*l+4*l^2)^(1/2)+2*l)*exp((1/2)*(1i*k-(-k^2-4*A^2*g+(4i)*k*l+4*l^2)^(1/2))*x)+C1*exp((1/2)*(1i*k+(-k^2-4*A^2*g+(4i)*k*l+4*l^2)^(1/2))*x)*(1i*k+(-k^2-4*A^2*g+(4i)*k*l+4*l^2)^(1/2)+2*l))/(g^(1/2)*exp(i*k*x)*A)
f2(x) = C1*exp((1/2)*(1i*k+(-k^2-4*A^2*g+(4*1i)*k*l+4*l^2)^(1/2))*x)+C2*exp((1/2)*(1i*k-(-k^2-4*A^2*g+(4*1i)*k*l+4*l^2)^(1/2))*x)
Here, C1 and C2 are arbitrary constants of integration that depend upon the boundary conditions.
  2 Comments
Wajahat
Wajahat on 23 Jan 2018
@Roberson, can you provide me the code of the above solution
Walter Roberson
Walter Roberson on 24 Jan 2018
simplify( dsolve([diff(f1(x), x) = l*f1(x)+A*g^(1/2)*exp(-I*k*x+I*omg*t)*f2(x), diff(f2(x), x) = -l*f2(x)-A*g^(1/2)*exp(I*k*x-I*omg*t)*f1(x)]), size)
This is Maple code, not MATLAB code.

Sign in to comment.

More Answers (0)

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!