
coupled differential equation with constant coefficients
3 views (last 30 days)
Show older comments

here 'kappa' and 'sigma' are constants. The boundary conditions are;
R(-1)=1
S(1)=0
kappa=1.
I tried it using dsolve but the graph obtained werenot correct. If anyone can solve it using bvp4c in the region (0,2) , it would be of great help.
0 Comments
Accepted Answer
Ameer Hamza
on 22 Apr 2020
Edited: Ameer Hamza
on 22 Apr 2020
This code solves the given BV problem. See the documentation for details.
x = linspace(-1, 1, 100);
init = bvpinit(x, [0; 0]);
sol = bvp4c(@odeFun, @bvFun, init);
subplot(2,1,1);
plot(sol.x, real(sol.y));
title('real(sol)');
legend({'R', 'S'})
subplot(2,1,2);
plot(sol.x, imag(sol.y));
title('imaginary(sol)');
legend({'R', 'S'})
function dRSdz = odeFun(z, RS)
sigma = 1;
kappa = 2;
dRdz = 1i*sigma*RS(1) + 1i*kappa*RS(2);
dSdz = -1i*sigma*RS(2) - 1i*kappa*RS(1);
dRSdz = [dRdz; dSdz];
end
function res = bvFun(RSa, RSb)
res = [RSa(1)-1;
RSb(2)-0];
end

3 Comments
More Answers (0)
See Also
Categories
Find more on Boundary Value Problems in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!