Azzera filtri
Azzera filtri

Integration using BVP4C

5 visualizzazioni (ultimi 30 giorni)
Syed Mohiuddin
Syed Mohiuddin il 8 Apr 2023
Commentato: Torsten il 9 Apr 2023
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
While I run the program I get the value of U1 using the boundary conditions (y=0 and y=1), but now i need to get the integration of U1, between the limits 0 to 1.
In BVP4c, the solution is obtained using the boundary conditions (y=0 and y=1), but now how to get the solution? Please help me
Matlab programs is enclosed for your reference
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
  7 Commenti
Syed Mohiuddin
Syed Mohiuddin il 9 Apr 2023
where is the option to accept the answer?
Torsten
Torsten il 9 Apr 2023
Thanks a lot
You are welcome. I moved my comment to an answer (which now can be accepted).

Accedi per commentare.

Risposta accettata

Torsten
Torsten il 9 Apr 2023
Spostato: Torsten il 9 Apr 2023
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);
y(1)];
BC = @(ya,yb)[ya(1);yb(1)-C1;ya(4)-m1.*ya(2);yb(4)+m2.*yb(2);ya(5)];
yinit = [0.01;0.01;0.01;0.01;0];
solinit = bvpinit(linspace(0,1,50),yinit);
U1 = bvp4c(dydx,BC,solinit);
hold on
% plot y1(x) = f(x)
plot(U1.x,real(U1.y(1,:)),'r')
% plot y5(x) = integral_{t=0}^(t=x} f(t) dt
plot(U1.x,real(U1.y(5,:)),'b')
hold off
grid on
% print y5(1) = integral_{t=0}^(t=1} f(t) dt
U1.y(5,end)
ans = 0.5000 - 0.0000i

Più risposte (0)

Categorie

Scopri di più su Downloads in Help Center e File Exchange

Prodotti


Release

R2016b

Community Treasure Hunt

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

Start Hunting!

Translated by