Please help me....., the masseage error at the
Mostra commenti meno recenti
%Error using surf
%Too many input arguments.
%Error in proj (line 70)
%surf(X, Y, real(Z));

%code
function sol= proj
clc;clf;clear;
global n;
%Relation of base fluid
rhof=997.1*10^-3;kf=0.613*10^5;cpf=4179*10^4;muf=10^-3*10;
alfaf=kf/(rhof*cpf);
bef=21*10^-5;
ky=muf/rhof;
disp('ky');disp((muf/rhof));
%sigf=0.05*10^-8;
%Ag
ph1=0.01;
rho1=10500*10^-3;
cp1=235*10^4;
k1=429*10^5;be1=21*10^-5;
%sig1=0.74*10^-2;
%copper
ph2=0.01;
rho2=8933*10^-3;
cp2=385*10^4;
k2=400*10^5;
%sig2=5.96*10^-1;
be2=1.67*10^-5;
%Alumina
ph3=0.01;
rho3=3970*10^-3;
cp3=765*10^4;
k3=40*10^5;
be3=0.85*10^-5;
%sig3=3.5*10^-1;
%Relation of ternary hyprid
kn=kf*((k3+2*kf-2*ph3*(kf-k3))/(k3+2*kf+ph3*(kf-k3)));
kh=kn*((k2+2*kn-2*ph2*(kn-k2))/(k2+2*kn+ph2*(kn-k2)));
kt=kh*((k1+2*kh-2*ph1*(kh-k1))/(k1+2*kh+ph1*(kh-k1)));
mut= muf/((1-ph1)^2.5*(1-ph2)^2.5*(1-ph3)^2.5);
rhot=(1-ph1)*((1-ph2)*((1-ph3)+ph3*(rho3/rhof))+ph2*(rho2/rhof))+ph1*(rho1/rhof);
%vt=rhot*cpt
vt =(1-ph1)*((1-ph2)*((1-ph3)+ph3*((rho3*cp3)/(rhof*cpf)))+ph2*((rho2*cp2)/(rhof*cpf)))+ph1*((rho1*cp1)/(rhof*cpf));
%disp('vt');disp(vt);
%vb=rho*betb
vb =(1-ph1)*((1-ph2)*((1-ph3)+ph3*((rho3*be3)/(rhof*bef)))+ph2*((rho2*be2)/(rhof*bef)))+ph1*((rho1*be1)/(rhof*bef));
%disp('vb');disp(vb);disp(ky);
myLegend1 = {};myLegend2 = {};
a=0.009;b=0.45;c=12;p=0.001/((1-0.01)*(mut/muf)*(rhof/rhot));
Gr=0.01*bef^2; Ec=0.5;gamma=pi/4;
prf=6.9;Rd=0.5;
Tw=273+50;Ti=273+27;deltaT=Tw-Ti;
disp('coe');disp((mut/muf)*(rhof/rhot));
Lf=rhof*kf;
y0 = [1,0,1,0,0,1,0,1];
rr = [0.5 1 1.5];
m = linspace(0,1);
numn = numel(rr);
options =bvpset('stats','on','RelTol',1e-5);
Z = zeros(numn, length(m));
for K = 1:numn
n= rr(K);
solinit = bvpinit(m, y0);
sol = bvp4c(@projfun, @projbc, solinit, options);
Z(K, :) = deval(sol,m,1); % Store the z-axis data
end
[X, Y] = meshgrid(m, rr);
shading interp;
surf(X, Y, real(Z));
xlabel('eta');
ylabel('Gr');
zlabel('z');
title('Variation of velocity with Grashof number,Gr in 3D' );
grid on
shading flat;
colorbar;
function dy= projfun(~,y)
dy= zeros(8,1);
% alignComments
E = y(1);
dE = y(2);
F = y(3);
dF= y(4);
w = y(5);
dw=y(6);
t = y(7);
dt = y(8);
dy(1) = dE;
dy(2) = (((rhot/mut)*(c*n*(muf/rhof)*w*dE-(mut/muf)*(rhof/rhot)*p*(1-0.01)*E+Gr*c*n*sin(gamma)*(vb/(rhof*bef))*t)))^(1/(n));
dy(3) = dF;
dy(4) = (((rhot/mut)*(c*n*(muf/rhof)*w*dF)))^(1/(n));
dy(5) =-(a*F+b*E);
dy(6) = (((rhot/mut)*((c*n)^(1-n)*(muf/rhof)^(-0.5)*w*(-(a*F+b*E))+Gr*(c*n)^(1-n)*(muf/rhof)^(-0.5)*cos(gamma)*(vb/(rhof*bef))*t)))^(1/(n));
dy(7) = dt;
dy(8)=prf*(1/(kt/kf))*(1/(1+((prf*Rd)/((kt/kf)))))*(muf/rhof)*((vt/(rhof*cpf))*w*dt-(mut/muf)*Ec*(1/(c*n))*(dw)^2*(muf/rhof)^(1/(2*n))) ;
end
end
function res= projbc(ya,yb)
res= [ya(1)-1;
ya(3)-1;
ya(5);
ya(6);
ya(7)+1-(1/0.01)*ya(8);
yb(1)-0.01;
yb(3);
yb(7);
% yb(7);
];
end
4 Commenti
My guess is that you have shadowed SURF with some other function. What is the output of this command?:
which surf -all
In any case:
proj()
function sol = proj()
global n;
%Relation of base fluid
rhof=997.1*10^-3;kf=0.613*10^5;cpf=4179*10^4;muf=10^-3*10;
alfaf=kf/(rhof*cpf);
bef=21*10^-5;
ky=muf/rhof;
disp('ky');
disp((muf/rhof));
%sigf=0.05*10^-8;
%Ag
ph1=0.01;
rho1=10500*10^-3;
cp1=235*10^4;
k1=429*10^5;be1=21*10^-5;
%sig1=0.74*10^-2;
%copper
ph2=0.01;
rho2=8933*10^-3;
cp2=385*10^4;
k2=400*10^5;
%sig2=5.96*10^-1;
be2=1.67*10^-5;
%Alumina
ph3=0.01;
rho3=3970*10^-3;
cp3=765*10^4;
k3=40*10^5;
be3=0.85*10^-5;
%sig3=3.5*10^-1;
%Relation of ternary hyprid
kn=kf*((k3+2*kf-2*ph3*(kf-k3))/(k3+2*kf+ph3*(kf-k3)));
kh=kn*((k2+2*kn-2*ph2*(kn-k2))/(k2+2*kn+ph2*(kn-k2)));
kt=kh*((k1+2*kh-2*ph1*(kh-k1))/(k1+2*kh+ph1*(kh-k1)));
mut= muf/((1-ph1)^2.5*(1-ph2)^2.5*(1-ph3)^2.5);
rhot=(1-ph1)*((1-ph2)*((1-ph3)+ph3*(rho3/rhof))+ph2*(rho2/rhof))+ph1*(rho1/rhof);
%vt=rhot*cpt
vt =(1-ph1)*((1-ph2)*((1-ph3)+ph3*((rho3*cp3)/(rhof*cpf)))+ph2*((rho2*cp2)/(rhof*cpf)))+ph1*((rho1*cp1)/(rhof*cpf));
%disp('vt');disp(vt);
%vb=rho*betb
vb =(1-ph1)*((1-ph2)*((1-ph3)+ph3*((rho3*be3)/(rhof*bef)))+ph2*((rho2*be2)/(rhof*bef)))+ph1*((rho1*be1)/(rhof*bef));
%disp('vb');disp(vb);disp(ky);
myLegend1 = {};
myLegend2 = {};
a=0.009;b=0.45;c=12;p=0.001/((1-0.01)*(mut/muf)*(rhof/rhot));
Gr=0.01*bef^2; Ec=0.5;gamma=pi/4;
prf=6.9;Rd=0.5;
Tw=273+50;Ti=273+27;deltaT=Tw-Ti;
disp('coe');disp((mut/muf)*(rhof/rhot));
Lf=rhof*kf;
y0 = [1,0,1,0,0,1,0,1];
rr = [0.5 1 1.5];
m = linspace(0,1);
numn = numel(rr);
options =bvpset('stats','on','RelTol',1e-5);
Z = zeros(numn, length(m));
for K = 1:numn
n= rr(K);
solinit = bvpinit(m, y0);
sol = bvp4c(@projfun, @projbc, solinit, options);
Z(K, :) = deval(sol,m,1); % Store the z-axis data
end
[X, Y] = meshgrid(m, rr);
shading interp;
surf(X, Y, real(Z));
xlabel('eta');
ylabel('Gr');
zlabel('z');
title('Variation of velocity with Grashof number,Gr in 3D' );
grid on
shading flat;
colorbar;
function dy= projfun(~,y)
dy= zeros(8,1);
% alignComments
E = y(1);
dE = y(2);
F = y(3);
dF= y(4);
w = y(5);
dw=y(6);
t = y(7);
dt = y(8);
dy(1) = dE;
dy(2) = (((rhot/mut)*(c*n*(muf/rhof)*w*dE-(mut/muf)*(rhof/rhot)*p*(1-0.01)*E+Gr*c*n*sin(gamma)*(vb/(rhof*bef))*t)))^(1/(n));
dy(3) = dF;
dy(4) = (((rhot/mut)*(c*n*(muf/rhof)*w*dF)))^(1/(n));
dy(5) =-(a*F+b*E);
dy(6) = (((rhot/mut)*((c*n)^(1-n)*(muf/rhof)^(-0.5)*w*(-(a*F+b*E))+Gr*(c*n)^(1-n)*(muf/rhof)^(-0.5)*cos(gamma)*(vb/(rhof*bef))*t)))^(1/(n));
dy(7) = dt;
dy(8)=prf*(1/(kt/kf))*(1/(1+((prf*Rd)/((kt/kf)))))*(muf/rhof)*((vt/(rhof*cpf))*w*dt-(mut/muf)*Ec*(1/(c*n))*(dw)^2*(muf/rhof)^(1/(2*n))) ;
end
end
function res= projbc(ya,yb)
res= [ya(1)-1;
ya(3)-1;
ya(5);
ya(6);
ya(7)+1-(1/0.01)*ya(8);
yb(1)-0.01;
yb(3);
yb(7);
% yb(7);
];
end
Tarek
il 3 Lug 2025
Modificato: Walter Roberson
il 3 Lug 2025
Stephen23
il 3 Lug 2025
Run this line:
which surf -all
show us what it displays.
Image Analyst
il 3 Lug 2025
Do that on the command window, not in your code. You put it in your code, which is OK, but you have to remember to go to the command window to see how many surf functions you have. Most likely you have written your own surf function which is being called instead of the built-in one.
Risposte (0)
Categorie
Scopri di più su 2-D and 3-D Plots in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
