Navigation

Operators and Keywords

Function List:

C++ API

sph2cart.m File Reference


Functions

endif if ((ismatrix(theta)&&ismatrix(phi)&&ismatrix(r))&&(size_equal(theta, phi)||isscalar(theta)||isscalar(phi))&&(size_equal(theta, r)||isscalar(theta)||isscalar(r))&&(size_equal(phi, r)||isscalar(phi)||isscalar(r))) x
else error ("sph2cart: arguments must be matrices of same size, or scalar")
 !assert (x, r)
 !assert (y,[0, 0, 0])
 !assert (z,[0, 0, 0])
 !assert (x,[1, 0,-1], eps)
 !assert (y,[0, 1, 0], eps)
 !assert (z,[0, 0, 0], eps)

Variables

 function [x, y, z]
 y = r .* cos (phi) .* sin (theta)
 z = r .* sin (phi)
endif endfunction!test !t = [0, 0, 0]
 !p = [0, 0, 0]
 !r = [0, 1, 2]

Function Documentation

!assert ( ,
eps   
)

!assert ( ,
eps   
)

!assert ( ,
eps   
)

!assert (  ) 

!assert (  ) 

!assert ( ,
 
)

else error ( "sph2cart: arguments must be matrices of same   size,
or scalar"   
)

endif if ( (ismatrix(theta)&&ismatrix(phi)&&ismatrix(r))&&(size_equal(theta, phi)||isscalar(theta)||isscalar(phi))&&(size_equal(theta, r)||isscalar(theta)||isscalar(r))&&(size_equal(phi, r)||isscalar(phi)||isscalar(r))   ) 


Variable Documentation

!p = [0, 0, 0]

!r = [0, 1, 2]

!test !t = [0, 0, 0]

function[x, y, z]

Initial value:

 sph2cart (theta, phi, r)

  if (nargin != 3)
    print_usage ()

y = r .* cos (phi) .* sin (theta)

z = r .* sin (phi)