project

# project - function project(u,w%last updated%PROJECT...

This preview shows pages 1–2. Sign up to view the full content.

function project(u,w) %last updated 5/9/94 %PROJECT Projecting vector U onto vector W orthogonally. Vectors % U and W can be either a pair of 2D or 3D vectors. A sketch % showing U being projected onto W is displayed sequentially. % % Use in the form ===> project(u,w) <=== FOR VERSION % or ===> project <=== 4.0 + % % In the latter case a menu of options is presented. One option % is a demo which randomly selects 2D or 3D. % %By: David R. Hill, Math Dept., Temple University, % Philadelphia, Pa. 19122 Email: [email protected] arrow='==>'; cont='Press ENTER to continue.'; head=' PROJECT vector U onto vector W'; errmess1='Too many or too few input arguments.'; errmess2='Input vectors not the same size.'; errmess3 = 'Input vectors not 2D or 3D.'; kindmenu=. .. ['You can enter a pair of 2D vectors or a pair of 3D vectors:'; ' <1> Demo '; ' <2> Enter two 2D vectors. '; ' <3> Enter two 3D vectors. '; ' '; ' <0> QUIT. ']; s0=' '; s1='Enter your choice. '; s2='Enter a pair of 2D vectors.'; s3='Enter a pair of 3D vectors.'; s4='The vector to project is U = '; s5='The vector to project onto is W = '; s6='Improper choice; try again.'; s7a='To enter a vector, include it entries between square brackets [. ...]'; s7b='with the entries separated by a space, then press ENTER.'; s8='P is the projection of U onto W.'; s9='Vectors must be real.'; mode=0; if nargin==1 | nargin > 2 disp([arrow ' ' errmess1]) return end if nargin==2 if sum(abs(imag(u)))~=0 | sum(abs(imag(w)))~=0 disp(s9),return end %Checking to make sure vectors are real. [mu,nu]=size(u);[mw,nw]=size(w);

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 01/26/2012 for the course MA 261 taught by Professor Stefanov during the Spring '08 term at Purdue.

### Page1 / 4

project - function project(u,w%last updated%PROJECT...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document
Ask a homework question - tutors are online