Filter löschen
Filter löschen

How to make space underneath the lines white opaque in 3D plot?

1 Ansicht (letzte 30 Tage)
I need to fill below the lines in opaque white so that it does not show lines behind. I tried to use the surf command but it does not work.
Here is my code until now:
[xn,yn] = meshgrid(linspace(0,0.5,14),linspace(-15,15,100));
zn = exp(-2*yn.^2).*xn;
xn = xn(:);
yn = yn(:);
zn = zn(:);
%%%%%%%%%%%%%%%%%%%%
index = find(diff(yn)<0);
zn(index) = nan;
%%%%%%%%%%%%%%%%%%%%%
len = index(1);
index = [0;index]+1;
index = index(1:2:end); % every 3rd line -- change to select how many lines to plot
elems = ((0:len) + index).'; % implicit singleton expansion
elems = elems(:);
xn = xn(elems);
yn = yn(elems);
zn = zn(elems);
plot3(xn,yn,zn)
set(gca,'ylim',[-10,10],'zlim',[0,2]);
box off
campos([-2.3393; -134.9790; -2.2455])

Akzeptierte Antwort

Star Strider
Star Strider am 21 Jul. 2018
A relatively simple way is to use the patch function:
[xn,yn] = meshgrid(linspace(0,0.5,14),linspace(-15,15,100));
zn = exp(-2*yn.^2).*xn;
figure
patch(xn,yn,zn,'w', 'EdgeColor','none')
hold on
plot3(xn,yn,zn,'b')
hold off
set(gca,'ylim',[-10,10],'zlim',[0,2]);
box off
campos([-2.3393; -134.9790; -2.2455])
view(45,15)

Weitere Antworten (0)

Kategorien

Mehr zu 2-D and 3-D Plots finden Sie in Help Center und File Exchange

Tags

Produkte


Version

R2017a

Community Treasure Hunt

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

Start Hunting!

Translated by