MATLAB: Creatting a polygon in matlab

polygon

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

Best Answer

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);