8 views (last 30 days)

Show older comments

Star Strider
on 18 Oct 2020

x = linspace(0, 10);

y = exp(-(x-5).^2)*0.2;

r = rand(1000,2).*[10 0.25];

[in,on] = inpolygon(r(:,1),r(:,2), x, y);

figure

plot(x,y)

hold on

plot(r(:,1), r(:,2),'.r')

plot(r(in,1), r(in,2), '.g')

hold off

producing:

Experiment with it to get the result you want.

.

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

Start Hunting!