From: Dinesh on
My problem is to solve a 2 point BVP nonlinear ode. I did it with IVP. But for attaining the correct end BCs, I need to do it by trail and error. I tried to follow fzero to do it but I could implement to this specific problem.
There are two odes in this system for which is denoted as
dPbA_dX(1,1), dPbA_dX(2,1)
The BCS are
X =1, Pb =0, A =0.441
X =0, Pb =0
The value Q has to be found by trial and error which I have taken as
-0.0055015295529553 to obtain a proper solution for this problem.
I would appreciate your help
Regards
Dinesh

Code:
% Filename : odefun.m
function dPbA_dX = odefun(X,PbA,Q)
global S theta_a R Z

Pb = PbA(1,1);
A = PbA(2,1);
Y = 1-R+R*X^2;
Ht = sqrt(3)*(1-A)^2;
dPbA_dX(1,1) = (-(Y+Z*(1-R))/(2*Y)*Ht-Q)*(6*S)/(sqrt(3)*Ht^2);

Pa = (2-(1-A)*Pb)/A;

f1_A = -0.86*A^2+0.345*A+0.515;
f2_A = 1/(2.571-A-A*log(1-A));
dPbA_dX(2,1) = -(2*R*X*(Pa-Pb)*f1_A)/(theta_a*Y*(2-(Pa-Pb)*f2_A));
end

Command line inputs to solve

global S theta_a R Z;S = 0.05;theta_a = 0.1;R = 0.2;Z = 1;
[X Y]=ode45(@odefun,[1 0],[0 0.441],[],-0.0055015295529553);
figure;plot(X,Y(1:size(X),1));xlabel('X');ylabel('P');
figure;plot(X,Y(1:size(X),2));xlabel('X');ylabel('Alpha');
From: Torsten Hennig on
> My problem is to solve a 2 point BVP nonlinear ode. I
> did it with IVP. But for attaining the correct end
> BCs, I need to do it by trail and error. I tried to
> follow fzero to do it but I could implement to this
> specific problem.
> There are two odes in this system for which
> for which is denoted as
> dPbA_dX(1,1), dPbA_dX(2,1)
> The BCS are
> X =1, Pb =0, A =0.441
> X =0, Pb =0
> The value Q has to be found by trial and
> rial and error which I have taken as
> -0.0055015295529553 to obtain a proper solution for
> this problem.
> I would appreciate your help
> Regards
> Dinesh
>
> Code:
> % Filename : odefun.m
> function dPbA_dX = odefun(X,PbA,Q)
> global S theta_a R Z
>
> Pb = PbA(1,1);
> A = PbA(2,1);
> Y = 1-R+R*X^2;
> Ht = sqrt(3)*(1-A)^2;
> dPbA_dX(1,1) =
> (1,1) =
> (-(Y+Z*(1-R))/(2*Y)*Ht-Q)*(6*S)/(sqrt(3)*Ht^2);
>
> Pa = (2-(1-A)*Pb)/A;
>
> f1_A = -0.86*A^2+0.345*A+0.515;
> f2_A = 1/(2.571-A-A*log(1-A));
> dPbA_dX(2,1) =
> (2,1) =
> -(2*R*X*(Pa-Pb)*f1_A)/(theta_a*Y*(2-(Pa-Pb)*f2_A));
> end
>
> Command line inputs to solve
>
> global S theta_a R Z;S = 0.05;theta_a = 0.1;R = 0.2;Z
> = 1;
> [X Y]=ode45(@odefun,[1 0],[0
> 0.441],[],-0.0055015295529553);
> figure;plot(X,Y(1:size(X),1));xlabel('X');ylabel('P');
> figure;plot(X,Y(1:size(X),2));xlabel('X');ylabel('Alph
> a');

Have you tried adding a third ODE as dQ/dx = 0
and use bvp4c instead of ODE45 with the _three_
boundary conditions from above ?

Best wishes
Torsten.
From: Dinesh on
Many Thanks Torsten.
That was a valuable idea!!! I got the results!!!!