Si2:Aula2
De WikiLICC
N =10; x1=-2; x2= 2; y1=-2; y2= 2;
for i=1:N
for j=1:N r = (i-1)/(N-1); s = (j-1)/(N-1); x(i,j)=x1 *r + x2*(1-r); y(i,j)=y1 *s + y2*(1-s);
xv(i) =x(i,j); yv(j) =y(i,j); z(i,j)=1-x(i,j)-y(i,j); end
end
surf(x,y, z,'facecol','interp')
fig = gcf(); fig.color_map=coolcolormap(32); contour2d( xv,yv, z,20)