creatting a polygon in matlab
3 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Mili Kian
le 4 Oct 2020
Commenté : Matteo Lo Preti
le 4 Oct 2020
hi
im going to create a polygon that is combination with points and function.
look at this picture
fourmula of top function is : y = 10+1*exp((-(x-15).^2)/10);
i want to creat a polygon the hatched figured
please help, thanks
0 commentaires
Réponse acceptée
Matteo Lo Preti
le 4 Oct 2020
x = linspace(0,30,50);
y = 10+1*exp((-(x-15).^2)/10);
x = [30 30 0 x];
y = [10 0 0 y];
warning('off', 'MATLAB:polyshape:repairedBySimplify')
polygon = polyshape(x,y);
figure;
plot(polygon);
2 commentaires
Plus de réponses (1)
Alan Stevens
le 4 Oct 2020
You could also use the patch function
x = [0 0:30 30 0];
y = [0 10+exp((-(x(2:end-2)-15).^2)/10) 0 0];
patch(x,y,'r')
0 commentaires
Voir également
Catégories
En savoir plus sur Elementary Polygons dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!