behavior of sph2cart() doesn't match matlab (?)
Ben Abbott
bpabbott at mac.com
Fri Jan 16 06:35:59 CST 2009
On Jan 15, 2009, at 8:57 PM, michael tesch wrote:
> GNU Octave, version 3.0.2, on macosx, from 'port'.
>
> I can't actually verify this on the matlab side, but I got code that
> was developed in matlab that did the following:
>
> for nsp=1:sz
> [TH,PHI]=cart2sph(xx,yy,zz);
> [X,Y,Z]=sph2cart(TH,PHI,A);
> spoke=[X ;Y ;Z];
> end
>
> Where xx,yy,zz,TH,PHI were all scalars, and A was a 1xN vector. The
> result was that spoke was a matrix of 3xN.
>
> the Octave implementation of sph2cart() dies with an error about
> mismatched dimensions of parameters.
>
I'm unable to reproduce any problem in the developers sources.
Nothing depends upon "nsp", so why the loop?
TH, PHI should each have same size as xx, yy, & zz. Are you sure A has
the same size?
To make certain everything is sized/shaped correctly, try inserting
the line below after cart2sph
whos xx yy zz TH PHI
Ben
More information about the Bug-octave
mailing list