Si2:Aula4
De WikiLICC
Quádrica
n1=20; n2=20;
for i=1:n1 s= (i-1)/(n1-1); x(i)= -1*(1-s) + 1*s; end for i=1:n2 s= (i-1)/(n2-1); y(i)= -1*(1-s) + 1*s; end
for i=1:n1 for j=1:n2 z(i,j)= x(i)^2 - y(j)^2; // grad2d( x(i), y(j) ) p(i,j)=-0.7; end end
plot3d( x, y, z) //plot3d( x, y, p)
contour( x, y , z , 11)
Vetor 2d
function vetor2d( xi,yi, xf,yf ) plot( [xi;xf], [yi;yf] ) endfunction
Gradiente
function grad2d( x,y ) fx= 2*x; fy=-2*y; plot( [x;x+fx], [y;y+fy] ) endfunction