# 8p - if x<0 T3=a 180 fprintf\n the polar coordinate you...

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

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

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

View Full Document
%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

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.

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

• Fall '06
• TWKnott
• Coordinate system, Spherical coordinate system, Polar coordinate system, Coordinate systems, Cylindrical coordinate system, polar coordinate

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern