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

조회 수: 2 (최근 30일)
Muhammad Said
Muhammad Said 2020년 6월 24일
편집: Muhammad Said 2020년 6월 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;
  댓글 수: 1
Muhammad Said
Muhammad Said 2020년 6월 25일
Hello Sir Takumi, Yes I want to plot surface graph,
It worked, Thank you so much.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Polygons에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by