Info

This question is closed. Reopen it to edit or answer.

How to solve this? i've tried so many times

1 view (last 30 days)
siti nurlia
siti nurlia on 18 Jun 2015
Closed: MATLAB Answer Bot on 20 Aug 2021
Error in calling BVP4C(ODEFUN,BCFUN,SOLINIT):
The derivative function ODEFUN should return a column vector of length 7.
global inf solution solution2 solution3 solution4 eta eta2 eta3 eta4 f f2 f3 f4 solinit
inf=15;
mesh=200;
solinit=bvpinit(linspace(0,inf,mesh),[1 1 0 0 1 1 1]);
%---odee1.m----
function Y=odee1(eta,F)
global sp M Pr Le Nt Nb Lambda vp s K Da phi1 phi2 phi3 rhof rhos sigmaf sigmas ks kf vf ;
%M magnetic field
%Pr Prandtl No.
%Le Lewis No.
%Nt Thermophoresis
%Nb Brownian motion
%K porous medium parameter
%Da damkholer number
%vf volume fraction
sp=0.1; vp=2; M=1; Pr=6.2; Lambda=-1; Le=10; Nt=0.1; Nb=0.1; vf=0.1;
s=1; K=0.5; Da=0.9;
phi1=((1-vp)^2.5*((1-vp)*rhof+vp*rhos));
phi2=(1-vp)*sigmaf+vp*sigmas;
phi3=(1-vp)*rhof+vp*rhos;
ks=401.0; %thermal conductivity of nanoparticles (copper)
kf=0.613; %thermal conductivity of base fluid (water)
rhof=997.1; %density of base fluid (water)
rhos=8933.0; %density of nanoparticles (copper)
Y=[F(2)
F(3)
F(2)*(phi1*phi2*M/phi3+(1/K))+(phi1/(Pr*rhof))*(F(2)^2-F(1)*F(3))
F(5)
(((ks+2*kf)+vf*(kf-ks))/((ks+2*kf)-2*vf*(kf-ks)))*((-F(1)*F(5))-Nb*F(7)*F(5)-Nt*F(5)^2)
F(7)
-Le*F(1)*F(7)-(Nt/Nb)*((((ks+2*kf)+vf*(kf-ks))/((ks+2*kf)-2*vf*(kf-ks)))*((-F(1)*F(5))-Nb*F(7)*F(5)-Nt*F(5)^2))+Da*F(6)];
%---bcc1.m---
function bcc1=bcc1(F0,Finf)
global sp M Pr Le Nt Nb Lambda vp s K Da phi1 phi2 phi3 rhof rhos sigmaf sigmas ks kf vf ;
sp=0.1; vp=2; M=1; Pr=6.2; Lambda=-1; Le=10; Nt=0.1; Nb=0.1; vf=0.1;
s=1; K=0.5; Da=0.9;
%sp slip parameter
%Lambda convective parameter
%vp velocity ratio parameter
%s injection or suction
bcc1=[F0(1)-s
F0(2)-vp-sp*F0(3)
F0(5)+Lambda
F0(6)-1
Finf(2)
Finf(4)
Finf(6)];

Answers (1)

Walter Roberson
Walter Roberson on 18 Jun 2015
You have
function bcc1=bcc1(F0,Finf)
Do not name your output variable the same as your function name; it usually leads to trouble.
You do not show any call to bvp4c or odee1.
You do not show any code that initializes your globals before calling odee1. Your code in bcc1 initializes the globals every time it is called, but if it were not called before odee1 then odee1 would be working with uninitialized globals. Uninitialized globals start with [] as their value; when used in a calculation those [] result in [] being returned by the expression. When you concatenate a [] in a column vector it takes no room, so the returned column vector may have fewer elements than you think you are putting into it.

Tags

Community Treasure Hunt

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

Start Hunting!