Unable to perform assignment because the size of the left side is 5-by-75 and the size of the right side is 5-by-87.

2 views (last 30 days)
plot(x,y(:,2,1),'color','Cyan','LineWidth',1.5)
Error using zeros
Size inputs must be scalar.

Error in solution>Problem1 (line 20)
y1 = zeros(5,75,M);

Accepted Answer

Torsten
Torsten on 30 Sep 2023
Problem1()
function Problem1
%% Parameters values
delta1=0.1; Ha=0.1; d1=0.1; d2=0.1; beta=0.1;
Pr=1; alpha= pi/4; S1=0.1; Ec=1; Gr=0.7;
sigma=350; Re=0.1; A=0.1;
Rs=1738; Rf=1053; Ss=2.3*10^7;
Sf=0.18; Cps=1046.7; Cpf=3594;
Ks=156; Kf=0.492;
phi=0.06;
B1=(1-phi)+phi*(Rs/Rf);
B2=(1-phi)^-2.5;
B3=1+((3*((Ss/Sf)-1)*phi)/(((Ss/Sf)+2)-((Ss/Sf)-1)*phi));
B4=((1-phi)+phi*((Rs*Cps)/(Rf*Cpf)));
B5=((Ks+2*Kf)-2*phi*(Kf-Ks))/((Ks+2*Kf)+phi*(Kf-Ks));
Marray = 1:10;
x = linspace(0,5,50);
for i=1:length(Marray)
M = Marray(i);
% In1.itial values
sol = bvpinit(x, [1 0 0 0 0 ]);
% solution in structure form
sol1 = bvp4c(@bvpexam2,@bcexam2,sol);
% x values
y1(i,:,:) = deval(sol1,x);
end
save y1.mat
%% Intial and boundary conditions
function res = bcexam2(y0, yB)
res=[y0(2)-1; y0(4); Pr*y0(1)+...
B5/B1*M*y0(5); yB(2)-A; yB(4)+S1-1;];
end
%% First order ODEs are define here
function ysol = bvpexam2(x,y)
yy1=(B1*(y(2)*y(2)-y(1)*y(3))+(B3*Ha*y(2))-A*A+...
((y(2)*y(2))*beta)*(((1+d1*exp(-x))^2)/(sqrt(1+d2*exp(-x))))...
+(B2/(sigma*Re))*((1+d1*exp(-x))/(1+d2*exp(-x)))*y(2)-B1*Gr*sin(alpha)*y(4))/B2;
yy2=(B4*Pr*(S1*y(2)+y(2)*y(4)-y(5)*y(1))-B2*Ec*Pr*y(3)*y(3)-delta1*Pr*y(4))/B5;
ysol=[y(2);y(3);yy1;y(5);yy2];
end
end

More Answers (0)

Community Treasure Hunt

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

Start Hunting!