Exercise Geometrical transformations xercise The following f




Exercise Geometrical transformations xercise The following figure show the relationship between the different coordinates cartesian, cylindrical and spherical. 1) Write a function Cart2Cyl permitting to pass from the cartesian coordinates of a point to the cylindrical ones. Write also the function Cyl20 art, 2) Write a function Cart2Sph penmitting to pass from the cartesian coordinates of a point to the spherical ones. 3) Write a function Cyl2sph permitting to pass from the cartesian coordinates of a point to the spherical ones. Indication

Solution

All the functions have been written in MATLAB

1) Cartesian to Cylindrical(Cart2Cyl)

function[rho,theta,z]=Cart2Cyl(x,y,z)
rho=sqrt(x^2+y^2);
theta=atan2d(y,x);

2) Cylindrical to Cartesian(Cyl2Cart)

function[x,y,z]=Cyl2Cart(rho,theta,z)
x=rho*cosd(theta);
y=rho*sind(theta);

3)Cartesian to Spherical(Cart2Sph)

function[r,theta,phi]=Cart2Sph(x,y,z)
r=sqrt(x^2+y^2+z^2);
theta=atan2d(y,x);
phi=atan2d(sqrt(x^2+y^2),z);

4)Spherical to Cartesian (Sph2Cart)

function[x,y,z]=Sph2Cart(r,theta,phi)
x=r*sind(phi)*cosd(theta);
y=r*sind(phi)*sind(theta);
z=r*cosd(phi);

5)Cylindrical to Spherical(Cyl2Sph)

function[r,theta,phi]=Cyl2Sph(rho,theta,z)
phi=acosd(rho,z);
r=sqrt(rho^2+z^2);

6)Spherical to Cylindrical(Sph2Cyl)

function[rho,theta,z]=Sph2Cyl(r,theta,phi)
rho=r*sind(phi);
z=r*cosd(phi);

 Exercise Geometrical transformations xercise The following figure show the relationship between the different coordinates cartesian, cylindrical and spherical.

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site