Getting error in the surfc plotting
3 次查看(过去 30 天)
显示 更早的评论
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 个评论
采纳的回答
Walter Roberson
2018-5-20
You need to use isosurface() instead of surfc()
10 个评论
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(:) ?
更多回答(0 个)
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Surface and Mesh Plots 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!