Help with Plotting the Envelope of a Scatter Plot in MATLAB
Ältere Kommentare anzeigen
Hello everyone,
I'm trying to plot the envelope of a scatter plot in MATLAB. However, when I use the envelope function, it returns the same plot without highlighting the upper or lower bounds.
This plot was created using a scatter plot, and when I attempt to filter it to retain only the extremum values, I end up with just a single slice of the data.
Has anyone encountered a similar issue or knows how I could extract and plot the envelope correctly (in red), as shown in the reference image?

Thanks in advance!
2 Kommentare
Zac Lee
am 4 Aug. 2025
Verschoben: Star Strider
am 4 Aug. 2025
The sampling density is very non-uniform, and makes it hard to see why the red boundary is appropriate in certain places. Why couldn't someone assume the following boundary drawing be valid? You need to achieve denser sampling throughout the shape for any automatic boundary detector to have any hope.

Akzeptierte Antwort
Weitere Antworten (1)
load xy
x=x(:)/1000; y=y(:);
r=median(diff(unique(y)));
shp=alphaShape([x,y],r*.8);
[~,P]=boundaryFacets(shp);
scatter(x,y,'.b'); hold on
plot(P(:,1),P(:,2),'r.--'); hold off
4 Kommentare
Zac Lee
am 4 Aug. 2025
Zac Lee
am 4 Aug. 2025
If you increase the sampling density in the region y<0.005, as I mentioned in my comment above, then there would be not need to incorporate a second method.
load xy
x=x(:); y=y(:);
r=median(diff(unique(y)));
s=1000;
shp=alphaShape([x/s,y],r*.8);
[~,P]=boundaryFacets(shp);
P(:,1)=P(:,1)*s;
scatter(x,y,'.b'); hold on
plot(P(:,1),P(:,2),'r.--'); hold off
Zac Lee
am 5 Aug. 2025
Kategorien
Mehr zu Scatter Plots finden Sie in Hilfe-Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


