DOA - Source Localization Using Generalized Cross Correlation
조회 수: 5 (최근 30일)
이전 댓글 표시
I am creating a Emegency Siren detector system and I am currently doing DOA Triangulation with two input microphones. I have generated my own single tone siren and tried adding it into this example: https://www.mathworks.com/help/phased/examples/source-localization-using-generalized-cross-correlation.html
Here's my matlab code:
L = 50; % distance between sensor array 1 and 2
N_e = 4; % no. of element reciver
rxULA = phased.ULA('Element',phased.OmnidirectionalMicrophoneElement,...
'NumElements',N_e);
% FIRST ARRAY
rxpos1 = [0;0;0];
rxvel1 = [0;0;0];
rxax1 = azelaxes(90,0);
%SECOND ARRAY
rxpos2 = [L;0;0];
rxvel2 = [0;0;0];
rxax2 = rxax1;
% SOURCE POSITION
srcpos = [30;100;0];
srcvel = [0;0;0];
srcax = azelaxes(-90,0);
srcULA = phased.OmnidirectionalMicrophoneElement;
% DEFINE WAVEFORM
N = 10000; %samples per second
x = (0:5*(N) - 1); % 2 seconds of audio
t = x/N; % time
fc = 1000; % carrier frequency
fm = 5; % modulation frequency
beta = 100; % modulation index
Vol = 1; % adjust to increase amplitude
c = 343; %speed of sound (m/s)
fs = 10000; % Sample rate
waveform = Vol*sin(2*pi*fc*t+ beta*sin(2*pi*fm*t)); % siren single tone waveform
% figure(1)
% plot(waveform)
signal = waveform(); % generate transmitted signal
nfft = 128;
radiator = phased.WidebandRadiator('Sensor',srcULA,...
'PropagationSpeed',c,'SampleRate',fs,...
'CarrierFrequency',fc,'NumSubbands',nfft);
collector1 = phased.WidebandCollector('Sensor',rxULA,...
'PropagationSpeed',c,'SampleRate',fs,...
'CarrierFrequency',fc,'NumSubbands',nfft);
collector2 = phased.WidebandCollector('Sensor',rxULA,...
'PropagationSpeed',c,'SampleRate',fs,...
'CarrierFrequency',fc,'NumSubbands',nfft);
channel1 = phased.WidebandFreeSpace('PropagationSpeed',c,...
'SampleRate',fs,'OperatingFrequency',fc,'NumSubbands',nfft);
channel2 = phased.WidebandFreeSpace('PropagationSpeed',c,...
'SampleRate',fs,'OperatingFrequency',fc,'NumSubbands',nfft);
[~,ang1t] = rangeangle(rxpos1,srcpos,srcax);
[~,ang2t] = rangeangle(rxpos2,srcpos,srcax);
sigt = radiator(signal,[ang1t ang2t]);
sigp1 = channel1(sigt(:,1),srcpos,rxpos1,srcvel,rxvel1);
sigp2 = channel2(sigt(:,2),srcpos,rxpos2,srcvel,rxvel2);
[~,ang1r] = rangeangle(srcpos,rxpos1,rxax1);
[~,ang2r] = rangeangle(srcpos,rxpos2,rxax2);
sigr1 = collector1(sigp1,ang1r);
sigr2 = collector2(sigp2,ang2r);
doa1 = phased.GCCEstimator('SensorArray',rxULA,'SampleRate',fs,...
'PropagationSpeed',c);
doa2 = phased.GCCEstimator('SensorArray',rxULA,'SampleRate',fs,...
'PropagationSpeed',c);
angest1 = doa1(sigr1);
angest2 = doa2(sigr2);
yest = L/(abs(tand(angest1)) + abs(tand(angest2)));
xest = yest*abs(tand(angest1));
zest = 0;
srcpos_est = [xest;yest;zest]
This is the error I am getting:
Error using phased.WidebandRadiator/validateInputsImpl (line
390)
The number of input signals does not match the number of
sensors.
Error in source_locate_1 (line 61)
sigt = radiator(signal,[ang1t ang2t]);
Can someone help me understand this? I am quite new to this kind of method and would appreiate your help.
댓글 수: 0
답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!