I am trying to plot the real part and imaginary part graph using bvp4c and I am getting a straight line,
2 views (last 30 days)
Show older comments
I have a coupled non-linear differential equations
(d^2 f)/(dy^2 )+m2*g2*dB/dy-2*i*R2*g1*f - g3*G1*y - R4*g1 = 0
(d^2 B)/(dy^2 )+t4/(1-i*H1)*df/dy=0
Boundary conditions are
f=0 at y=0
f=C1 at y=1
And
dB/dy-(t4/(P1* (1-i*H1 ) ))* B=0 at y=0
dB/dy+(t4/(P2 (1-i*H1 ) ))* B=0 at y=1
Matlab programs
close all
clc
p=1;
P1=2;
P2=2;
b1=0.00021;
b2=0.000058;
S1=0.005;
S2=580000;
G1=2;
m2=20;
R1=997.1;
R2=3;
C1=1;
R3=4420;
B=0.5;
H1=0.25;
K1=3;
R4=1;
t1=(1./((1-p).^2.5));
t2=(1-p)+(p.*(R3./R1));
t3=(1-p)+p.*((R3.*b2)./(R1.*b1));
S=(S2./S1);
t4=1-((3*(1-S).*p)./((2+S)+(1-S).*p));
g1=t2./t1;
g2=1/t1;
g3=t3./t1;
m1=(t4./(P1.*(1-1i.*H1)));
m2=(t4./(P2.*(1-1i.*H1)));
dydx=@(x,y)[y(3);
y(4);
-m2.*g2.*y(4)+2.*1i.*R2.*g1.*y(1)+g3.*G1.*x+R4.*g1;
(-t4./(1-1i.*H1)).*y(3)];
BC = @(ya,yb)[ya(1);yb(1)-C1;ya(4)-m1.*ya(2);yb(4)+m2.*yb(2)];
yinit = [0.01;0.01;0.01;0.01];
solinit = bvpinit(linspace(0,1,50),yinit);
U1 = bvp4c(dydx,BC,solinit);
hold on
plot(U1.x,real(U1.y(1,:)),'r','linewidth',1.5)
plot(U1.x,imag(U1.y(1,:)),'b','linewidth',1.5)
I am trying to plot the real part and complex part graph and I am getting a straight line, I have checked the program and it seems good, but the type of graph I need to get is not appearing, I think the bvp4c code I have written might be wrong. Please help me. The graph I have to get should be of the form. Thank you
8 Comments
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!