Connecting 2D ellipses in a 3D plot to make a 3D 'tunnel'
2 次查看(过去 30 天)
显示 更早的评论
Hi all,
I have produced a 3D plot which shows the mean trace of a number of movements. I have also come up with an 'error band' using a number of ellipses (see attached figure).
While this is suitable for the desired application, I think that if I can connect the ellipses and produce a semi-transparent 'tunnel', this would look far better.
The code I used to produce the plot in the figure is as follows:
hold off
plot3(x_mean_origin,y_mean_origin,z_mean_origin,'r','LineWidth',3)
hold on
for i=1:1:100
a=stddevmax_smooth(i);
b=zstddev(i);
x=a*cos(theta)+x_mean_origin(i);
y=zeros(1,numel(x))+y_mean_origin(i);
z=b*sin(theta)+z_mean_origin(i);
rotate(plot3(x,y,z,'m'),[0 0 1],phi(i),[x_mean_origin(i) y_mean_origin(i) z_mean_origin(i)]);
end
I am aware of functions such as 'fill' and 'surf' and 'mesh', but not really sure how to incorporate them in this instance. I'm hoping it is fairly straightforward, so any support you can provide is greatly appreciated! Also I have only supplied a small section of my code, so if any more is required for context, just let me know.
Many thanks!
0 个评论
采纳的回答
Star Strider
2020-2-29
I am not certain what you want.
Try this:
F = openfig('Mean throw with 1SD error band.fig');
Ax = findobj(F,'Type','Axes');
D = findobj(F,'Type','line');
Q2 = D(50);
for k = 1:numel(D)
X(k,:) = D(k).XData;
Y(k,:) = D(k).YData;
Z(k,:) = D(k).ZData;
end
figure
hs = surf(X, Y, Z)
set(hs, 'EdgeColor','none', 'FaceAlpha', 0.5)
grid on
producing:
Experiment to get the result you want. See Surface Properties to understand options for surf plots to get it to look the way you want it to look.
更多回答(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!