필터 지우기
필터 지우기

Getting error in the surfc plotting

조회 수: 9 (최근 30일)
Mukul
Mukul 2018년 5월 20일
편집: Walter Roberson 2018년 6월 22일
Tn = 100;
ns = 30;
alpha = 0
beta = 0
gama = 0
phi1 = linspace(-Tn,Tn,ns);
phi2 = linspace(-Tn,Tn,ns);
phi3 = linspace(-Tn,Tn,ns);
%Phase Angle Mesh-Grid
[phi_1,phi_2,phi_3] = meshgrid(phi1,phi2,phi3);
phi_12 = phi_2 - phi_1;
phi_21 = phi_1 - phi_2;
phi_13 = phi_3 - phi_1;
phi_31 = phi_1 - phi_3;
phi_23 = phi_3 - phi_2;
phi_32 = phi_2 - phi_3;
k11 = 917.3770;
k22 = 917.3770;
k33 = 917.3770;
k12 = 458.6885;
k13 = 458.6885;
k23 = 458.6885;
X = -(k12.*cos(alpha*pi*n/360).*cos(beta*pi*n/360).*sin(phi_12*pi*n/180))-(k13.*cos(alpha*pi*n/360).*cos(gama*pi*n/360).*sin(phi_13*pi*n/180))
Y = -(k12.*cos(alpha*pi*n/360).*cos(beta*pi*n/360).*sin(phi_21*pi*n/180))+(k23.*cos(beta*pi*n/360).*cos(gama*pi*n/360).*sin(phi_23*pi*n/180))
Z = -(k13.*cos(alpha*pi*n/360).*cos(gama*pi*n/360).*sin(phi_31*pi*n/180))+(k23.*cos(beta*pi*n/360).*cos(gama*pi*n/360).*sin(phi_32*pi*n/180))
figure(1);
surfc(phi_12,phi_13,X); colorbar;
figure(2);
surfc(phi_21,phi_23,Y); colorbar;
figure(3);
surfc(phi_31,phi_32,Z); colorbar;
Getting the following error:
Error using matlab.graphics.chart.primitive.Surface/set
Value must be a vector or 2D array of numeric type
Error in matlab.graphics.chart.internal.ctorHelper (line 8)
set(obj, pvpairs{:});
Error in matlab.graphics.chart.primitive.Surface
Error in surf (line 150)
hh = matlab.graphics.chart.primitive.Surface(allargs{:});
Error in surfc (line 53)
hs = surf(cax, args{:});
Error in (line 68)
surfc(phi_12,phi_13,X); colorbar;
can anyone please help me fixing this error?
  댓글 수: 6
Star Strider
Star Strider 2018년 5월 20일
Describe what you want to do.
Mukul
Mukul 2018년 5월 21일
편집: Stephen23 2018년 5월 21일
Just think in a very simple way: since alpha, beta and gama is zero, so the cos term is 1 and then the X Y and Z equation becomes
X=-k*sin(phi_12)-k*sin(phi_13)
Y=-k*sin(phi_21)+k*sin(phi_23)
Z=-k*sin(phi_31)+k*sin(phi_32)
Where
k=917.377
phi_12 = phi_2 - phi_1;
phi_21 = - phi_12;
phi_13 = phi_3 - phi_1;
phi_31 = - phi_13;
phi_23 = phi_3 - phi_2;
phi_32 = - phi_23;
Now I would like to do surfc plot of X in terms of phi_12, phi_13, Y in terms of phi_21 and phi_23 and Z in terms of phi_31 and phi_32 over the range of phi_1, phi_2 and phi_3 is -100 degree to 100 degree.

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

채택된 답변

Walter Roberson
Walter Roberson 2018년 5월 20일
You need to use isosurface() instead of surfc()
  댓글 수: 10
Walter Roberson
Walter Roberson 2018년 6월 20일
I don't think they should be the same. You are defining coordinates parametrically in different ways, and I see no reason why the shapes should all have the same angle when converted to one fixed set of coordinates.
I think that it is more likely that you can choose different coordinate basis that would make a different pair of the two look the same, and a third coordinate basis that make the remaining pair look the same -- each time there being one that looked different.
Using phi_12(:), phi_13(:) as a consistent arbitrary projection affects how the shapes look. Why should that pair of coordinates for the projection be any more right than, say, phi_23(:), phi_13(:) ?
Mukul
Mukul 2018년 6월 22일
편집: Walter Roberson 2018년 6월 22일
Hi Walter thank you for your comments:
If I try in other ways without using the mesh grid function, I am getting these shapes where the three shapes looks almost same
Tn = pi/2;
ns = 30;
for i=1:40
for j=1:40
phi12 = pi/4*((i-20)/20);
phi23 = pi/4*((j-20)/20);
phi31 = -phi23 - phi12;
X(i,j)=sin(phi12)-sin(phi31);
Y(i,j)=-sin(phi12)+sin(phi23);
Z(i,j)=-sin(phi23)+sin(phi31);
end
end
a=1:40;
b=a;
aon2=10:30;
bon2=aon2;
figure(1);
surfc(a,b,X); colorbar;
figure(2);
surfc(a,-b,Y); colorbar;
figure(3);
surfc(-a,-b,Z); colorbar;
end
Do you think in the previous case, the mesh grid function causes the shapes not to be same?
Could you please comment on this?

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

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Scalar Volume Data에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by