Question: 1 ) [ 5 pts ] COORDINATE TRANSFORMATION In MATLAB, a user defined function allows for the calling of repeated operations that do not exist
pts COORDINATE TRANSFORMATION
In MATLAB, a user defined function allows for the calling of repeated operations that do not exist as built in functions. Functions are created in their own mfiles, with the format:
function outputArguments functionnameinputArguments
where the m file must be saved as the name of the function. To call a function in the command window, the first line from the function file without the first word function can be used.
a Write a function carCyl with the header line
function rphi,z carCylmathrmxmathrmymathrmz
that converts coordinates of a point given in the Cartesian coordinate system to points in the cylindrical coordinate system.
b Write a function carSph with the header line function Rtheta,phi carSph mathrmxmathrmymathrmz
that converts coordinates of a point given in the Cartesian coordinate system to points in the spherical coordinate system.
c Write a function cylCar with the header line function xyz cylCarrphi,z
that converts coordinates of a point given in the cylindrical coordinate system to points in the Cartesian coordinate system.
d Write a function sphCar with the header line function xyz sphCarRtheta, phi
that converts coordinates of a point given in the spherical coordinate system to points in the Cartesian coordinate system.
e Verify that the point found by one function will return the original point using the opposite function. In particular, use the point xyz with the functions carCyl and carSph then use the results with the functions cylCar and sphCar to show that is returned.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
