how to convert spherical coordinate to cartesian in DoA algorithm?

7 views (last 30 days)
Hello everyone, I am trying to localize an ultrasonic source with microphone Arrays using DoA algorithm. In fact, I want to have the final figure in Cartesian coordinate but DoA produces it in Azimuth and Elevation angles. I have already tried [x,y,z] = sph2cart(azimuth,elevation,r), but because there are too many different values for Azimuth and Elevation which are unknown to me, I cant have x,y,z. Do you know perhaps an easier way? I hope ist all clear! Thank you in advance.
h = phased.ConformalArray();
t= 1/2*(1+sqrt(5));
n=16;
c= ones(n,1)';
c(:)=1:16;
h.ElementPosition = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;(sqrt(c).*cos(2*pi*t*c))*0.0375;(sqrt(c).*sin(2*pi*t*c))*0.0375];
h.ElementNormal = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0;0 0 0 0 0 ...
0 0 0 0 0 0 0 0 0 0 0];
h.Element = ...
phased.OmnidirectionalMicrophoneElement('BackBaffled',true,'FrequencyRange',[48e3 580e3]);
ang1 = [0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 ; 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]; % First signal
ang2 = [-3; 35]; % Second signal
angs = [ang1];
c = 343;
fc = 107e3; % Operating frequency
lambda = c/fc;
pos = getElementPosition(h)/lambda;
Nsamp = 1000;
nPower = 0.09;
rs = rng(2007);
scov=sig;
x = sensorsig(pos,Nsamp,angs,nPower,scov);
broadsideAngle = az2broadside(angs(1,:),angs(2,:));
hMVDR = phased.MVDREstimator2D('SensorArray',h,...
'PropagationSpeed',c,'OperatingFrequency',fc,...
'AzimuthScanAngles',-45:60,'ElevationScanAngles',-10:60,...
'DOAOutputPort',true,'NumSignals',1);
[~,ang] = step(hMVDR,x);
plotSpectrum(hMVDR);

Accepted Answer

Honglei Chen
Honglei Chen on 16 Nov 2016
Not sure what you mean by "too many azimuth and elevation values". According to your settings, you should only get one set of azimuth/elevation values back.
This being said, in general, it would be difficult to translate the angle to a point in Cartesian coordinate based on your approach because all these DOA algorithm assume that the signal is from far field. Thus, only the direction matters, not the distance. So in some sense, you can think that you have azimuth and elevation angles in your spherical coordinates, but not the r component. But if you have the knowledge of r, then you can use sph2cart to do the translation.
HTH

More Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!