Hi,
I'm trying to solve a boundary value problem using bvp4c. My equation is as folows.
G'= k1*rw*uw;
Here k1 is a constant. rw is a known (1x100) vector. uw and G' are unknowns. The boundary conditions are
G'(0)= Ginf*0.99 and
G'(L)= Ginf*0.01;
I tried to solve this using the following code, but it gives me the following error.
"The boundary condition function BCFUN should return a column vector of length 2."
Following is my code.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function [y1,uw] = testbvp
rhoW= [0.912669843 0.912669843 0.913062531 0.913082624 0.913083242 0.913083252 0.913083251 0.913083251 0.91308325 0.91308325];
a= 0.0015; Ginf= 2.3881;
options = [];
solinit = bvpinit(linspace(0,1,10),1,1);
sol = bvp4c(@testode,@testbc,solinit,options,a,rhoW,Ginf);
y1= deval(sol,x);
% -----------------------------------------------------------------
function dydx = testode(x,y,a,rhoW,~,uw)
k1= -4/a;
dydx = k1*rhoW.*uw;
% -----------------------------------------------------------------
function res = testbc(ya,yb,~,~,Ginf,~)
res = [ya(1)-Ginf*0.99
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
I need to find the unknown values of G' and uw. Thanks in advance.
Luke