MATLAB: Which function to use for plotting a polygon with 4 coordinates

2d polygoncolor

I have a list of sets of 4 coordinates..(x1, y1)(x2, y2)(x3, y3)(x4, y4) and an intensity value associated with a set of four coordinates.
I need to plot a figure connecting these four points and as many figures as there are sets in the list in one Plot. Also, I need to color each polygon with a color specified by a number(intensity value).
How can it be achieved ?

Best Answer

x=[x1 x2 x3 x4]
y=[y1 y2 y3 y4 ]
fill(x,y,'r')
Example
x=[0 2 3 2.5 1 0];
y=[0 0 1 2 2 0]
plot(x,y) % to plot polygon
fill(x,y,'g') % to fill the polygon