Getting error in the surfc plotting

3 ビュー (過去 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 Center および File ExchangeSurface and Mesh Plots についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by