MATLAB: Issue with solving system of odes in matlab

MATLAB

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.

Best Answer

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.