% Cálculo Multivariable % PROGRAMA PARA LA VISUALIZACIÓN DE PLANOS EN 3D % Ver 1.2 % Se requiere un punto “P” por donde pase el plano. % Se requiere la normal “N” al plano. % P(X,Y,Z) = PUNTO CONTENIDO EN UN PLANO % V(N1,N2,N3) = NORMAL DEL PLANO %%%%%%% %%%%%%% function out = arrow3(P,V,color) if nargin < 3 color = 'b'; end x0 =P(1); y0 = P(2); z0 = P(3); a = V(1); b = V(2); c = V(3); l = max(norm(V), eps); x = [x0 x0+a]; y = [y0 y0+b]; z = [z0 z0+c]; hchek = ishold; plot3(x,y,z,color) hold on h = l - min(.2*l, .2) ; v = min(.2*l/sqrt(3), .2/sqrt(3) ); upper = [h, v*tan(pi/6), 0]'; lower = [h, -v*tan(pi/6), 0]'; r = sqrt(a^2 +b^2); if r > 0 col1 = [a b c]/l; col2 = [-b/r, a/r, 0]; col3 = [-a*c/(l*r), -b*c/(l*r), r/l]; Q = [col1; col2; col3]' ; else if c > 0 Q = [0 0 -1; 0 1 0; 1 0 0]; else Q = [0 0 1; 0 1 0; -1 0 0]; end end p = Q*upper; q = Q*lower; plot3([x0+p(1), x0+a], [y0+p(2), y0+b], [z0+p(3), z0+c], color) plot3([x0+q(1), x0+a], [y0+q(2), y0+b], [z0+q(3), z0+c], color) if hchek == 0 hold off end