Question: Please write a MATLAB script and include comments, please. 2. (5 points) Polar and rectangular coordinates are related to each other as illustrated by the

 Please write a MATLAB script and include comments, please. 2. (5

Please write a MATLAB script and include comments, please.

2. (5 points) Polar and rectangular coordinates are related to each other as illustrated by the figure below: y-axis x=r cos(8) X,Y y = sin() X-axis 2+ y2 Develop two MATLAB functions: a. A function named polar2rect will accept the arguments for radius (r) and angle (theta) and provide the corresponding x and y coordinates. The angle should be input as degrees, not radians. b. A function named rect2polar will accept the arguments for x and y and provide the corresponding radius (r) and angle (theta). The angle should be output as degrees, not radians. Write a main script that will ask the user: i. What conversion is being requested (polar rectangular or rectangular polar). ii. The appropriate starting data for the conversion (either x and y coordinates or the radius (r) and angle (theta). iii. Output the result to the user c. Test your function using the data sets below: Answers: X-coord 2 2 -2 -2 Y-coord 4 -4 Radius 4.4721 4.4721 4.4721 4.4721 Angle 63.43490 -63.43490 116.5651 -116.5651 4 -4

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!