8p - if x<0; T3=a+180; fprintf( '\n the polar coordinate...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
1. Flowchart START INPUT x,y r=SQRT(x^2+y^2) IF y<0 IF x<0 t=a-180 a=arctan(y/x) IF y>=0 IF x<0 t=a+180 OUTPUT r,t STOP T F T F T F T F t=a t=a
Background image of page 1

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

View Full DocumentRight Arrow Icon
%this function is to convert rectangular components to polar coordinates %within the range of -180<theta<180 function [r,a]=XYtoRA(x,y) r=sqrt(x^2+y^2); a=atand(y/x); if y<0; if x<0; T1=a-180; fprintf( '\n the polar coordinate you asked for is; %f , %f degrees \n' ,r,T1); else T2=a; fprintf( '\n the polar coordinate you asked for is; %f , %f degrees \n' ,r,T2); end end if y>=0;
Background image of page 2
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: if x<0; T3=a+180; fprintf( '\n the polar coordinate you asked for is; %f , %f degrees \n' ,r,T3); else T4=a; fprintf( '\n the polar coordinate you asked for is; %f , %f degrees \n' ,r,T4); end end Sample run >> [X,Y]=XYtoRA(5,0) the polar coordinate you asked for is; 5.000000 , 0.000000 degrees X = 5 Y = >> [X,Y]=XYtoRA(-5,0) the polar coordinate you asked for is; 5.000000 , 180.000000 degrees X = 5 Y = >>...
View Full Document

This note was uploaded on 03/19/2008 for the course ENGE 1114 taught by Professor Twknott during the Fall '06 term at Virginia Tech.

Page1 / 4

8p - if x<0; T3=a+180; fprintf( '\n the polar coordinate...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online