elec_cart2sph

elec_cart2sph - % phi = atan( sqrt( (x-xo).^2 + (y-yo).^2 )...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
function [theta,phi,r] = elec_cart2sph(x,y,z,xo,yo,zo) % elec_cart2sph - Convert Cartesian (X,Y,Z) to spherical (theta,phi,r) % % Useage: [theta,phi,r] = elec_cart2sph(X,Y,Z,xo,yo,zo) % % Result: (theta,phi,r) are double floating point (Nx1); % r is radius, % theta is counterclockwise rotation from +x in x-y plane (azimuth), % phi is elevation with respect to Cz-axis, % % % +ve x-axis from origin through T4 (right ear) % +ve y-axis from origin through Nasion (at theta = +90degrees) % % Note: Conversion from Cartesian to spherical coordinates, with % origin or centroid (xo,yo,zo) is: % theta = atan( (y-yo) ./ (x-xo) );
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % phi = atan( sqrt( (x-xo).^2 + (y-yo).^2 ) ./ (z-zo) ); % r = sqrt( (x-xo).^2 + (y-yo).^2 + (z-zo).^2); % % $Revision: 1.1 $ $Date: 2009/04/28 22:13:54 $ % Licence: GNU GPL, no implied or express warranties % History: 07/2001, Darren.Weber_at_radiology.ucsf.edu % %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% if ~exist('xo', 'var') xo = 0; end if ~exist('yo', 'var') yo = 0; end if ~exist('zo', 'var') zo = 0; end theta = atan( (y-yo) ./ (x-xo) ); phi = atan( sqrt( (x-xo).^2 + (y-yo).^2 ) ./ (z-zo) ); r = sqrt( (x-xo).^2 + (y-yo).^2 + (z-zo).^2 ); return...
View Full Document

This note was uploaded on 10/04/2010 for the course ENG 42336 taught by Professor Thomasholland during the Spring '10 term at UC Davis.

Ask a homework question - tutors are online