I get this message(Attempted to access F(5); index out of bounds because numel(F)=4.) when I run the code below..
조회 수: 1 (최근 30일)
이전 댓글 표시
refpaper3
function refpaper3
format long
%% ------------------------------------------------------------------------
% Parameters
%--------------------------------------------------------------------------
NP=200; %the number of meshpoints
eta_infty =15;
%% ------------------------------------------------------------------------
for i=1:4
A=0.1*[0 2 4 6];
Omega=A(i);
% eps=0.1; %A=0.1*[2 4 6 8 9]; %Medium porosity
% gamma=3; %A=[2 3 4 5 6];
% M=0.6; %A=[2 3 4 5 6]; %magnetic field parameter
% Omega=3; %A=[4 5 6 7 8]; %cylinder curvature parameter
Alpha=45; %curvature angel
P=0.2; %A=[3 4 5 6 7]; %porous medium parameter
Gr=0.2; %A=[0 2 3 4 5]; %themal Grashof number
Gm=0.2; %mass Grashof number
Rd=0.1; %A=0.1*[0 1 3 5 7]; %Radiation parameter
Ec=0.1; %Eckert number
Du=0.5; %A=0.1*[1 2 3 4 5]; %Defour number
Sr=0.2; %A=0.1*[2 3 4 5 6]; %Soret number
Pr=1.0; %for water7.56 %prentdl number
Sc=5; %A=[5 7 9 11 13]; %Schmidt number
Bi1=0.2;
Bi2=0.2;
% QM=0.1; %mass flux
% QH=0.24; %heat flux
%--------------------------------------------------------------------------
% Solve the problem
%--------------------------------------------------------------------------
int=ones(1,7); %We have 7 variables
int=0.*int;
% int=[0 0 -0.003 -0.35 0 0 -0.05];
options = [];
solinit = bvpinit(linspace(0,eta_infty,NP),int);
sol = bvp4c(@fsode,@fsbc,solinit,options);
eta = sol.x; %this is eta
f = sol.y; %These are the dependenat variables
FF=f(1,:);
DF=f(2,:);
DDF(i)=-f(3,1);
TH=f(4,:);
DTH(i)=f(5,1);
Fi =f(6,:);
DFi=f(7,1);
HH(i)= -2*DTH(i);
RR(i)=Omega;
%QH=(1+xi_2)*gamma+(1/Pr)*(1+((4*Rd)/3))*DTH;
%% ------------------------------------------------------------------------
% Plot the results
%--------------------------------------------------------------------------
end
%% ------------------------------------------------------------------------
% The model equations
%--------------------------------------------------------------------------
function dfdeta = fsode(eta,Y)
M1=1+(2*Omega*eta);
M2=1+(4*Rd/3);
F(1) = Y(2);
F(2) = Y(3);
F(3) =(-1/M1)*((2*Omega*Y(3))+(Y(1)*Y(3))+(Y(2)^2)-(P*Y(2))+(((Gr*Y(4))+(Gm*Y(6)))*cosd(Alpha)));
F(4)=Y(5);
F(5)=(-1/(M1*M2))*((2*M2*Omega*Y(5))+(Pr*Y(1)*Y(5))+(Du*((M1*F(7))+(2*Omega*Y(7))))+(Pr*Ec*M1*(Y(3))^2));
F(6)=Y(7);
F(7)=(-1/M1)*((2*Omega*Y(7))+(Sc*Y(1)*Y(7))+(Sr*((M1*F(5))+(2*Omega*Y(5)))));
dfdeta = [ F(1)
F(2)
F(3)
F(4)
F(5)
F(6)
F(7)
];
end
% --------------------------------------------------------------------------
function res = fsbc(ya,yb)
res = [ya(1)
ya(2)-1
ya(5)+(Bi1*(1-ya(4)))
ya(7)+(Bi2*(1-ya(6)))
yb(2)
yb(4)
yb(6)
];
end
end
채택된 답변
Alan Stevens
2024년 1월 28일
In fsode you try to use F(7) when calculating F(5), before you have calculated F(7)!
댓글 수: 2
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Develop Apps Using App Designer에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!