You are on page 1of 1

% This script allows the user to input a non-variable vector

% in rectangular coordinates and obtain the cylindrial, or


% spherical components. The user must also enter the point
% location where this transformation occurs; the result
% depends on the vector's observation point
clear
% prompt the user for the vectors and check to see if entered
% properly, else set to 0
disp('Enter the rectangular vector (in the ');
v = input(' format [x y z])... \n > ');
if isempty(v); v 0 [0 0 0]; end
disp('Enter the location of the vector (in the ');
p = input(' format [x y z])... \n > ');
if isempty(p); p [0 0 0]; end
disp('Cylindrical components [rho phi(rad) z]:')
phi = atan2(p(2),p(1));
% Create

You might also like