Hello, I have been trying to surf two parallel circles but data dimensions don't match and I don't know why. Any help would be nice. Thank you, Omar
1 次查看(过去 30 天)
显示 更早的评论
radius = 1; center = [0 0]; theta = linspace(0,2*pi); X = center(1)+radius.*cos(theta); X=[X;X]; Y = center(2)+radius.*sin(theta); Y=[Y;Y]; Z = zeros(size(X));Z=[Z;Z];Z(2,:)=1;surf(X,Y,Z); hold on;
0 个评论
采纳的回答
elias GR
2016-10-6
Furthermore, surf is not the right command to do what you want. Try the following instead:
fill3(X(1,:),Y(1,:),Z(1,:),'r')
hold on
fill3(X(2,:),Y(2,:),Z(2,:),'b')
更多回答(2 个)
Massimo Zanetti
2016-10-6
编辑:Massimo Zanetti
2016-10-6
You doubled Z, delete the
Z=[Z;Z];
line and everything will be fine.
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Annotations 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!