Question
Quadrant of xy coord. Use the values of vectors x and y to determine the appropriate location of each (xi,yi) coord pair. If the coord lies on the origin, x-axis, or y-axis, output a statement indicating the origin and appropriate and quadrants. Otherwise, output the appropriate positive or negative axis and quadrants. Use fprintf for all your output. See example code and make sure to include a final "else" clause. Example output: (1,2) is in Quadrant I (0,0) is origin (Quadrants I, II, III and IV) (5,0) is on the y-axis Quadrants I and IV ...
Explanation / Answer
x=[ 12 3 4 0 6 -2 4]; y=[ 3 4 7 0 -1 -5 6]; for i=1:7% size of vector if (x(i)==0 & y(i)==0) fprintf('(%d, %d) origin ', x(i),y(i)); end if ((x(i)>0|x(i)0|y(i)0 & y(i)>0 fprintf('(%d, %d) Quadrant I ', x(i),y(i)); end if x(i)>0 & y(i)