creatting a polygon in matlab
1 次查看(过去 30 天)
显示 更早的评论
hi
im going to create a polygon that is combination with points and function.
look at this picture
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/370813/image.jpeg)
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 个评论
采纳的回答
Matteo Lo Preti
2020-10-4
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 个评论
更多回答(1 个)
Alan Stevens
2020-10-4
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 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Elementary Polygons 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!