Question: USE MATLAB TO ANSWER: Write a function file called coord_convert.m that converts rectangular coordinates to polar coordinates or vice versa. There should be 3 inputs
USE MATLAB TO ANSWER:
Write a function file called coord_convert.m that converts rectangular coordinates to polar coordinates or vice versa.
There should be 3 inputs to coord_convert.m: coordinates a and b and a character string called coord that has the value rectangular if the input coordinates are rectangular coordinates or polar if the input coordinates are polar coordinates.
There should be 2 outputs from coord_convert.m: coordinates c and d in the new coordinate system. The values of c and d should be calculated as described in Appendix A.
If coord is anything other than rectangular or polar the values of the outputs c and d should both be set equal to NaN
Be sure to include comments describing the function and its inputs and output.

Appendix A - Coordinate Conversion Formulas If the input coordinates a and b are rectangular coordinates, calculate the corresponding polar coordinates as follows. tan-(b/a)if a >0 ? + tan-1 (b/a) if a 0 if a0 and b
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
