Surface plot(Z must be a matrix, not a scalar or vector)

1 次查看(过去 30 天)
Hello
I was trying to plot using the following surface graph but i get this error. Can someone help me please? Thank You
[b1,a1] =meshgrid(0.1:0.01:0.05,0.01:0.001:0.03);
b1 =0.22;
b2 =0.48;
a1 =0.006;
e1 =0.2;
e2 =0.2;
bh =0.000097;
bv =0.27;
r =0.0035;
d =0.3;
x =0.86;
u =0.00045;
v =0.10;
uc =0.55;
um =0.00034;
ue =0.7;
Nh =100;
Nv =100;
c=0.5;
m=20;
r=0.01;
Ro = (b1.*b2.*a1.*r.*bh.^2*bv.*Nh^2*Nv)./(u.^2.+v.*(d.^+u.^+ue)*(u.^+uc.^+r.^x)*(u.^+um.^+r));
surf(b1,a1,Ro)
hold on
z2 =0*b1+ 1
surf(b1,a1,z2,'MarkerFaceColor','red')
xlabel('\beta_1')
ylabel('\mu')
zlabel('R_0')
colorbar;
Error using surf (line 74)
Z must be a matrix, not a scalar or vector.
Error in SR1 (line 23)
surf(b1,a1,Ro)

回答(1 个)

Takumi
Takumi 2020-6-24
First of all, the argument of meshgrid is wrong.
0.1:0.01:0.05←must be greater than 0.1.
Second, variavle b1 and a1 has been overwritten.
Do you want to do something like that?
[b1,a1] =meshgrid(0.1:0.01:0.5,0.01:0.001:0.03);
% b1 =0.22;
b2 =0.48;
% a1 =0.006;
e1 =0.2;
e2 =0.2;
bh =0.000097;
bv =0.27;
r =0.0035;
d =0.3;
x =0.86;
u =0.00045;
v =0.10;
uc =0.55;
um =0.00034;
ue =0.7;
Nh =100;
Nv =100;
c=0.5;
m=20;
r=0.01;
Ro = (b1.*b2.*a1.*r.*bh.^2*bv.*Nh^2*Nv)./(u.^2.+v.*(d.^+u.^+ue)*(u.^+uc.^+r.^x)*(u.^+um.^+r));
surf(b1,a1,Ro)
hold on
z2 =0*b1+ 1
surf(b1,a1,z2,'MarkerFaceColor','red')
xlabel('\beta_1')
ylabel('\mu')
zlabel('R_0')
colorbar;

类别

Help CenterFile Exchange 中查找有关 Lighting, Transparency, and Shading 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by