Question: 1 ) [ 5 pts ] COORDINATE TRANSFORMATION In MATLAB, a user defined function allows for the calling of repeated operations that do not exist

1)[5 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 m-files, with the format:
function [outputArguments]= functionname(inputArguments)
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 car2Cyl(0) with the header line
function [r,phi,z]= car2Cyl(\(\mathrm{x},\mathrm{y},\mathrm{z})\)
that converts coordinates of a point given in the Cartesian coordinate system to points in the cylindrical coordinate system.
(b) Write a function car2Sph0 with the header line function [R,theta,phi]= car2Sph (\(\mathrm{x},\mathrm{y},\mathrm{z}\))
that converts coordinates of a point given in the Cartesian coordinate system to points in the spherical coordinate system.
(c) Write a function cyl2Car() with the header line function [x,y,z]= cyl2Car(r,phi,z)
that converts coordinates of a point given in the cylindrical coordinate system to points in the Cartesian coordinate system.
(d) Write a function sph2Car() with the header line function [x,y,z]= sph2Car(R,theta, 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 [x,y.z]=[1,1,1] with the functions car2Cyl and car2Sph, then use the results with the functions cyl2Car and sph2Car to show that \([1,1,1]\) is returned.
1 ) [ 5 pts ] COORDINATE TRANSFORMATION In

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 Programming Questions!