Asked by Doctor61
on 29 Jan 2013

Hey,

I have been searching for a way to be able to define spherical coordinates of the points in a XYZ matrix, based on a local coordinate system (new origin and xyz axes). All I have been running into is this new global2localcoord code in Matlab 2012 that the previous versions apparently don't have.

Could someone help me figure out how to do this?

*No products are associated with this question.*

Answer by Jan Simon
on 30 Jan 2013

Edited by Jan Simon
on 30 Jan 2013

Accepted answer

The general procedure is:

localCoor = rand(3, 100); translationOfLocalOrigin = rand(3, 1); rotationOfLocalCoorSystem = <DirectionCosinMatrix>; % [3 x 3] matrix

globalCoor = bsxfun(@minus, localCoor, translationOfLocalOrigin); globalCoor = rotationOfLocalCoorSystem * globalCoor;

If you need more details, e.g. for the paraphrased "<DirectionCosinMatrix>", please post more details for your available input.

Doctor61
on 30 Jan 2013

Opportunities for recent engineering grads.

## 0 Comments