Ask your own question, for FREE!
Mathematics 25 Online
OpenStudy (hitaro9):

Matlab help? Setting a length of a line to 1? So I have these two planes intersecting, and a line describes their intersection (right?) P0 = [0 0 0]; N1 = [-2 1 2]; N2 = [1 1 1]; plane(P0, N1), hold on, plane(P0, N2), L = cross(N1, N2); arrow3(P0,L), view(68,30), hold off, I need to set the blue line's length to 1. How do I do this?

OpenStudy (hitaro9):

The blue line being arrow 3 as found in this code: 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

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!