How to apply MVDR to real signal?

8 views (last 30 days)
Marko Jankovic
Marko Jankovic on 31 Oct 2023
Answered: George on 4 Dec 2023
Dear , in the code below I implemented MVDR beamformer with simulated signals and it works.
In the second code, I tried to repeat all that on real signals, ie. instead of the simulated signal, I put the signal measured with the same microphone array as in the simulation (3 microphones - broadside configuration). The code doesn't work!
Simulation:
clear
close
clc
% Define parameters for the sine sweep signal
fs = 44100; % Sampling frequency (Hz)
t = 0:1/fs:5; % Time vector (5 seconds in this example)
f0 = 20; % Starting frequency (Hz)
f1 = 20000; % Ending frequency (Hz)
% Generate the sine sweep signal
sig = chirp(t, f0, 5, f1, 'logarithmic')'; % log sweep
% Generate white noise
a = -0.99;
b = 0.99;
noise = ((b-a).*rand(size(t)) + a)';
array = phased.ULA('NumElements',3,'ElementSpacing',0.042,'ArrayAxis','y');
c = 343;
carrierFreq = fs;
collector = phased.WidebandCollector('Sensor',array,'PropagationSpeed',c,...
'SampleRate',fs,'ModulatedInput',true,...
'CarrierFrequency',carrierFreq);
incidentAngle = [1; 0]; % desni=90, levi=-90
sig1 = collector(sig,incidentAngle);
rx = (sig1 + noise)/2;
beamformer = phased.SubbandMVDRBeamformer('SensorArray',array,...
'Direction',incidentAngle,'OperatingFrequency',carrierFreq,...
'PropagationSpeed',c,'SampleRate',fs,'TrainingInputPort',false, ...
'SubbandsOutputPort',true,'WeightsOutputPort',false);
[y,subbandfreq] = beamformer(rx);
% Plot the sine sweep signal
plot_time = 0.2*fs;
figure(1)
plot(t(1:plot_time), sig(1:plot_time));
xlabel('Time (s)');
ylabel('Amplitude');
title('Sine Sweep Signal');
% Plot the white noise signal
figure(2)
plot(t(1:plot_time), noise(1:plot_time));
xlabel('Time (s)');
ylabel('Amplitude');
title('White Noise Signal');
% Plot the white noise signal
figure(3)
plot(t(1:plot_time), real(rx(1:plot_time,2)));
xlabel('Time (s)');
ylabel('Amplitude');
title('Mixed');
figure(4)
plot(t(1:plot_time),real(rx(1:plot_time,2)),'b')
hold on
plot(t(1:plot_time),real(y(1:plot_time)),LineWidth=2)
hold off
xlabel('Time')
ylabel('Amplitude')
legend('Original','Beamformed');
title('Original + Beamformed');
Real signal:
clear
close
clc
% Position of microphone in matrix 1 = L, 2 = C i 3 = R
audio1 = load('Dana_Audio_Raw.mat');
% audio2 = load('Dana_Audio_Raw_Coupler_Water.mat');
fs = 44100;
audio_file = audio1.audio_file;
% audio_file = audio2.audio_file;
ln = 5*fs;
rx = audio_file(1:ln,:);
t = 0:1/fs:5;
% BEAMFORMING MVDR Beamformer
% % Define parameters for the sine sweep signal
% fs = 44100; % Sampling frequency (Hz)
% t = 0:1/fs:5; % Time vector (5 seconds in this example)
% f0 = 20; % Starting frequency (Hz)
% f1 = 20000; % Ending frequency (Hz)
%
% % Generate the sine sweep signal
% sig = chirp(t, f0, 5, f1, 'logarithmic')'; % log sweep
%
% % Generate white noise
% a = -0.99;
% b = 0.99;
% noise = ((b-a).*rand(size(t)) + a)';
array = phased.ULA('NumElements',3,'ElementSpacing',0.042,'ArrayAxis','y');
c = 343;
carrierFreq = fs;
% collector = phased.WidebandCollector('Sensor',array,'PropagationSpeed',c,...
% 'SampleRate',fs,'ModulatedInput',true,...
% 'CarrierFrequency',carrierFreq);
incidentAngle = [1; 0]; % desni=90, levi=-90
% sig1 = collector(sig,incidentAngle);
% rx = (sig1 + noise)/2;
beamformer = phased.SubbandMVDRBeamformer('SensorArray',array,...
'Direction',incidentAngle,'OperatingFrequency',carrierFreq,...
'PropagationSpeed',c,'SampleRate',fs,'TrainingInputPort',false, ...
'SubbandsOutputPort',true,'WeightsOutputPort',false);
[y,subbandfreq] = beamformer(rx);
% Plot the sine sweep signal
plot_time = 5*fs;
% % figure(1)
% plot(t(1:plot_time), sig(1:plot_time));
% xlabel('Time (s)');
% ylabel('Amplitude');
% title('Sine Sweep Signal');
% % Plot the white noise signal
% figure(2)
% plot(t(1:plot_time), noise(1:plot_time));
% xlabel('Time (s)');
% ylabel('Amplitude');
% title('White Noise Signal');
%
% % Plot the white noise signal
% figure(3)
% plot(t(1:plot_time), real(rx(1:plot_time,2)));
% xlabel('Time (s)');
% ylabel('Amplitude');
% title('Mixed');
figure(4)
plot(t(1:plot_time),real(rx(1:plot_time,2)),'b',LineWidth=1)
hold on
plot(t(1:plot_time),real(y(1:plot_time)))
hold off
xlabel('Time')
ylabel('Amplitude')
legend('Original','Beamformed');
title('Original + Beamformed');
% sound(real(rx(:,6)),fs)
% sound(real(y),fs)
How to apply real signal to simulated code?

Answers (1)

George
George on 4 Dec 2023
Hi Marko,
It looks like the simulation code that you posted is assuming that the input to the WidebandCollector is modulated, because the ModulatedInput property is set to true.
However, I think when you collect real data using your microphones, the data is unmodulated, meaning it is directly proportional to the raw voltage. It is possible that the phased.SubbandMVDRBeamformer just doesn't work with unmodulated data - there are no documented examples showing it being used with unmodulated data.
I would reccomend going to the Phased Array System Toolbox Beamformer documentation page, and browing the Wideband Beamformers:
Some of these beamformers are documented to work with unmodulated data, such as the FrostBeamformer, GSCBeamformer, or TimeDelay beamformers.
https://www.mathworks.com/help/phased/ref/phased.frostbeamformer-system-object.html
https://www.mathworks.com/help/phased/ref/phased.timedelaylcmvbeamformer-system-object.html
I would recommend getting the simulation working if you set the ModulatedData property on the WidebandBeamformer to false to more closely match your setup, and then experimenting with some of those other beamformers that are documented to work with unmodulated data.
Best,
George

Products


Release

R2023a

Community Treasure Hunt

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

Start Hunting!