Please someone correct the error

maxellfluid
Error using vertcat
Dimensions of arrays being concatenated are not consistent.

Error in solution>maxellfluid/bcexam2 (line 23)
res=[y0(1)-0;y0(2)-1;y0(4)-0;y0(6)-1;yinf(2)-0;yinf(4)-0,yinf(6)-0];

Error in bvparguments (line 106)
testBC = bc(ya,yb,bcExtras{:});

Error in bvp4c (line 122)
bvparguments(solver_name,ode,bc,solinit,options,varargin);

Error in solution>maxellfluid (line 10)
sol1=bvp4c(@bvpexam2,@bcexam2,sol);
function maxellfluid
beta=1.5;
gamma=0.25;
Pr=3.5;
lam=0.2;
E=0.5;
sol=bvpinit(linspace(0,5,50),[0 0 0 0 0 0 0]);
sol1=bvp4c(@bvpexam2,@bcexam2,sol);
x1=sol1.x;
y1=sol1.y;
figure (1)
plot(x1,y1(2,:),'b'); %plot of prime
hold on
figure(2)
plot(x1,y1(4,:),'--'); %plot of g
hold on
figure(3)
plot(x1,y1(6,:),':'); %plot of theta
hold on
function res=bcexam2(y0,yinf)
res=[y0(1)-0;y0(2)-1;y0(4)-0;y0(6)-1;yinf(2)-0;yinf(4)-0,yinf(6)-0];
end
function ysol=bvpexam2(~,y)
yy1=(1/(1-beta*y(1)^2))*(-y(1)*y(3)+y(2)^2-2*lam*(y(4)-beta*y(1)*y(5))-2*beta*y(1)*y(2)*y(3));
yy2=(1/(1-beta*y(1)^2))*(-y(1)*y(5)+y(2)*y(4)+2*lam*(y(2)+beta*(y(2)^2-y(1)*y(3)+y(4)))-2*beta*y(1)*y(2)*y(5));
yy3=(1/(1+E*y(6)-Pr*gamma*y(1)^2))*(-E*y(7)^2-Pr*y(1)*y(7)+Pr*gamma*y(1)*y(2)*y(7));
ysol=[y(2);y(3);yy1;y(5);yy2;y(7);yy3];
end
end

回答 (1 件)

Walter Roberson
Walter Roberson 2022 年 7 月 25 日

0 投票

res=[y0(1)-0;y0(2)-1;y0(4)-0;y0(6)-1;yinf(2)-0;yinf(4)-0,yinf(6)-0];
^
You used a comma in the place marked, instead of a semi-colon.

カテゴリ

質問済み:

2022 年 7 月 25 日

回答済み:

2022 年 7 月 25 日

Community Treasure Hunt

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

Start Hunting!

Translated by