Question: HW 6 In 3 D space, the Cartesian coordinates ( x , y , z ) can be converted to spherical coordinates ( radius r
HW
In D space, the Cartesian coordinates can be converted to spherical coordinates radius polar angle, azimuth angle, by the following equations:
Write a function fnprintspherical that prints the Cartesian coordinates and corresponding spherical coordinates, The function printspherical calls a subfunction fnconvertspher that converts from Cartesian to spherical coordinates.
Write a script, CartSpher that reads the Cartesian coordinates from an external file, convert to spherical coordinate, and print the results. When the script reads the Cartesian coordinates from a file, assume that are saved in matrix, thus fnprintspherical should be in the loop to print all the results.
Here is the requirement for the script:
table
Read the file XYZtxt by using the following function
input Let user input file name
load read the file that user input
When you load the data, assign the data values to the matrix variable. Use this matrix variable as input variables to the function, fnprintspherical
Display should follow the below format
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
