-
Notifications
You must be signed in to change notification settings - Fork 5
/
wideband_doa_test_8_chan_recording.m
59 lines (56 loc) · 1.71 KB
/
wideband_doa_test_8_chan_recording.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
addpath './DOAToolbox'
addpath './wav'
%% Initializations
%Variables:
%Fixed:
% l: distance between sensors in m
% m: number of sensors
% fs: sampling frequency
%Tunables:
% wlen: affects frequency precision, is the most important parameter
% bins: number of samples for the narrowband algo to work with
% wlen and bins set the total number of necessary samples, N
% olf: overlapping factor, integer between 0 and wlen-1
% L: precision/ resolution, how many slices to divide the angle domain
l = 0.04; %distance between sensors in m
m = 8; %num of sensors
fs = 8820; %sampling frequency
wlen = 512; %fft order, or window size
bins = 10; %num of windows
olf = wlen/2; %overlapping factor for stft( fft_separate)
N = wlen * bins; %num of samples
L = 180; %num of divisions for [-pi/2, pi/2]
%% Generate data
[Y,Fs ] = wavread('8chan_test3.wav');
n = 1;
%% Wideband DOA
[N, phicapon, phimusic , thetaesprit, f] = wideband_doa(real(Y), l, fs, n, wlen, bins, olf, L);
%% Plotting
% figure(3)
% plot(t, real(Y));
% xlabel('Time');
% ylabel('Value');
% title('Data set');
% legend('Sensor 1','Sensor 2','Sensor 3','Sensor 4','Sensor 5','Sensor 6','Sensor 7','Sensor 8');
% grid on
%% Plot the spatial spectrum
figure(1)
x = ((0:(L-1)) .* pi/L - pi/2); % x in radians
x = x * 180/pi; %x in degrees
imagesc(x,f, phicapon.');
xlabel('Degrees');
ylabel('Frequency');
title('Capon estimation');
grid on
figure(2)
x = ((0:(L-1)) .* pi/L - pi/2); % x in radians
x = x * 180/pi; %x in degrees
imagesc(x,f, phimusic.');
xlabel('Degrees');
ylabel('Frequency');
title('MUSIC estimation');
grid on
%% Clean-up
rmpath './DOAToolbox'
rmpath './wav'
clear Fs L N Y bins f fs l m n olf phicapon phimusic thetaesprit wlen x