Error in the execution of the solution of first ODEs nonlinear equations with imaginary coefficients
Show older comments
i need the the value of b2 from the following differential equation
(db1/dz)-(i*beta1*b1) = (C*b2)
(db2/dz)- (i*beta2*b2) = -(C*b1)
with the boundary conditions:
b1(z=0) = 1, b2(z=0) = 0
where the value of beta1 = 7.2e+06, beta2 = 7.1e+06, and C = 0. so please send the correct solution. i am sending my code with this mail in which

The error which we are getting after running the program it is attached with in JPEG form
clc;
clear all;
close all;
format long;
n1 = 1.453755; % Referactive Index of the Core Region
n2 = 1.450588; % Referactive Index of the First Cladding Region
% Find the difference between n1 & n2
n = n1-n2;
disp('n = ');
disp(n);
n3 = 1; % Referactive Index of the First Cladding Region
lambda =1.3*10^-6; % Wavelenth of the Proapagating Light in Micrometer
% Find the value of propagation constant k
k = 2*pi/lambda;
disp('k = ');
disp(k);
rho25 = 4.53038170273*10^-6; % Radius of the core region in micrometer
rhocl25 = 57.535847624671*10^-6; % Radius of the cladding in micrometer
S25 = (rhocl25/rho25)
nf25_01 = 1.45200634;
nf25_02 = 1.4505416;
V25 = rho25*k*sqrt(n1^2-n2^2)
bt25_01 = k*(nf25_01)
bt25_02 = k*(nf25_02)
C25=0;
%%calculation of the b1 at z = z1 when boundary conditions are b1(z=0)=1, b2(z=0)=0.
ode1 = 'Db1 = (i*(bt25_01)*b1)-(C25*b2)';
ode2 = 'Db2 = (i*(bt25_02)*b2)-(C25*b1)';
initials = 'b1(0)=1, b2(0)=0';
b2 = dsolve('ode1','ode2', 'initials', 'z')
% br2 = roots([1, (i*bt25_02)])
% bb2 = abs(br2)
Answers (2)
Torsten
on 22 Jul 2015
syms beta1 beta2 C b1(z) b2(z)
sol=dsolve(diff(b1)-1I*beta1*b1==C*b2, diff(b2)-1I*beta2*b2==C*b1, b1(0)==1, b2(0)==0);
or
Best wishes
Torsten.
5 Comments
Ashish Kumar
on 22 Jul 2015
Torsten
on 22 Jul 2015
What's the error message you get when you execute the above two lines ?
I don't have MATLAB at hand.
(By the way: the solution for C=0 is
b1(z)=exp(1I*beta1*z), b2(z)=0
)
Best wishes
Torsten.
Ashish Kumar
on 22 Jul 2015
Torsten
on 22 Jul 2015
I guess you entered
syms beta1 beta2 C b1(z) b2(z)
sol=dsolve(diff(b1)-1I*beta1*b1==C*b2, diff(b2)-1I*beta2*b2==C*b1, b1(0)==1, b2(0)==0)
sol.b1
sol.b2
?
Best wishes
Torsten.
Ashish Kumar
on 22 Jul 2015
Edited: Walter Roberson
on 25 Jul 2015
Walter Roberson
on 25 Jul 2015
ode1 = subs(sym('diff(b1(z),z) = (i*(bt25_01)*b1(z))-(C25*b2(z))'));
ode2 = subs(sym('diff(b2(z),z) = (i*(bt25_02)*b2(z))-(C25*b1(z))'));
initials = [sym('b1(0)=1'), sym('b2(0)=0')];
b2 = dsolve(ode1, ode2, initials, 'z')
Categories
Find more on Ordinary Differential Equations 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!