Si2:Aula2
De WikiLICC
Vetor tridimensional
function vetor( v ) param3d( [0;v(1)], [0;v(2)], [0;v(3)] ) endfunction
Produto vetorial
function [w]=prodvet( u, v ) w(1)=u(2)*v(3) - u(3)*v(2); w(2)=u(3)*v(1) - u(1)*v(3); w(3)=u(1)*v(2) - u(2)*v(1); endfunction
Reta
function reta( p, v ) for i=1:30 t=(i-1)/(30-1)*10-5; x(i)= p(1)+v(1)*t; y(i)= p(2)+v(2)*t; z(i)= p(3)+v(3)*t; end param3d( x,y,z) endfunction
Projeção
function [p]=projecao( v, b ) p=((v'*b) / norm(b)^2 )* b ; endfunction