フィルターのクリア

Connecting 2D ellipses in a 3D plot to make a 3D 'tunnel'

2 ビュー (過去 30 日間)
Thomas Swain
Thomas Swain 2020 年 2 月 29 日
コメント済み: Star Strider 2020 年 2 月 29 日
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!

採用された回答

Star Strider
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.
  2 件のコメント
Thomas Swain
Thomas Swain 2020 年 2 月 29 日
This is exactly what I was hoping for. Thank you so much!!
Star Strider
Star Strider 2020 年 2 月 29 日
As always, my pleasure!

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeSurface and Mesh Plots についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by