correct the following code for unsteady maxwell nanofluids

%f"'+ff"-f'^2+lamda(g+Nh)-Mf'-delta(f'+(eta/2)*f")=0
%g"-Prfg'+PrNb(g'h'+Nt/Nb*g^2)-delta((eta/2)f')Pr+PrEc*f"=0
%h'+Scfh'+Nt/Nbg"-gamma*h+(f-(epsilon*eta/2)h')=0
%f(0)=s,f'(0)=1, g'(0)=-gamma(1-g(0)), h(0)=1; f'(infinity)=0,
%g(infinity)=0, h(infinity)=0
function sol= sample2
global B;
B=4;
global s;
s=0;
solinit1=bvpinit(linspace(0,B,100),@sample1init);
sol=bvp5c(@sample1ode,@sample1bc,solinit1);
figure(1);
plot(sol.x,sol.y(1,:),'g.-');
hold on;
plot(sol.x,sol.y(3,:),'b.-');
hold on;
plot(sol.x,-sol.y(5,:)),'r.-';
xlabel('\eta');
ylabel('F(\eta),G(\eta),-H(\eta)');
legend('F(\eta)','G(\eta)','-H(\eta)')
hold off;
end
function dydx=sample1ode(x,y)
dydx=[ % f=y(1);f'=y(2), f"=y(3), f"'=y(4)
y(4)+y(1)y(3)-y(2)*y(2)-delta(y(2)+1/2(eta*y(3))-epsion(y(1)*y(1)*y(4)-2*y(1)*y(2)*y(3))-beta*y(2)+lamda(y(5)+N*y(8))-M*y(2)=0)
% g=y(5) g'=y(6), g"=y(7)
y(7)-Pr*(y(1)*y(2))-delta*Pr*((eta/2)*y(2)+Pr*Nb*(y(6)*y(9)+(Nt/Nb)*y(5)*y(5))+Pr*Ec*y(3)=0
% h=y(8)
y(9)+Sc*y(1)*y(9)+(Nt/Nb)*y(7)+(y(1)-epsilon*(eta/2)*y(9)
];
end
function res=sample1bc(ya,yb)
res=[ya(1)-s %f(0)=s
ya(2)-1 %f'(0)=1
yb(2)-1 %f'(inf)=1
yb(5) % g(inf)=0
ya(6)+gamma(1-y(5)) % g'(0)=-gamma(1-y(5))
ya(8)+1 % h(0)=-1
yb(8) %h(inf)=0
];
end
function v=sample1init(x)
global s;
g=s;
v=[ 0 % f(0)
g % f'(0)
1 % g(0)
g % g'(0)
0 % h(0)
];
end
I am getting the following error, Can anyone help
sample3
File: sample3.mlx Line: 27 Column: 11
Invalid expression. Check for missing multiplication operator, missing or unbalanced delimiters, or other syntax error. To construct matrices, use brackets instead of parentheses.

 채택된 답변

Torsten
Torsten 2023년 10월 14일
이동: Torsten 2023년 10월 14일
dydx has to consist of 6 equations:
dydx(1) = y(2), dydx(2) = y(3), dydx(3) = f'''
dydx(4) = y(5), dydx(5) = g''
dydx(6) = h'
Thus you also need 6 boundary conditions and 6 initial conditions.
And don't forget multiplication signs in your expressions, e.g.
y(4)+y(1)<here>y(3)-y(2)*y(2)-delta<here>(y(2)+1/2(eta*y(3))-epsion<here>(y(1)*y(1)*y(4)-2*y(1)*y(2)*y(3))-beta*y(2)+lamda<here>(y(5)+N*y(8))-M*y(2)

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Characters and Strings에 대해 자세히 알아보기

질문:

2023년 10월 14일

이동:

2023년 10월 14일

Community Treasure Hunt

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

Start Hunting!

Translated by