Time Delay Beamforming with microphone arrays

Hello there,
I am using the time delay algorithm to do time Domain beamforming on my recieved signals. The direction source in the code must be set to 'Property' but when I do so, I get an error regarding this. I attach my code, the signal and the error here. Thanks.
h = phased.ConformalArray();
t= 1/2*(1+sqrt(14));
n=32;
c= ones(n,1)';
c(:)=1:32;
h.ElementPosition = [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;(sqrt(c).*cos(2*pi*t*c))*0.02655;(sqrt(c).*sin(2*pi*t*c))*0.02655];
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;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]);
% sampling rate
fs= 999e3;
t=0:1/20e6:3e-4;
c = 343;
fc = 500000; % Operating frequency
hc = phased.WidebandCollector('Sensor',h,...
'PropagationSpeed',c,'SampleRate',fs,...
'ModulatedInput',true,'CarrierFrequency',fc);
A=1:32;
B=1:32;
A(A>0)=-1.5708;
B(B>0)=1.5508;
ang=[A;B];
x=step(hc,recon,ang);
% Beamforming
hbf = phased.TimeDelayBeamformer('SensorArray',h,...
'DirectionSource',Property,'Direction',ang,...
'PropagationSpeed',c,...
'SampleRate',fs,'SubbandsOutputPort',true,...
'WeightsOutputPort',true);
[y,w] = step(hbf,x);
figure;
% Plot signals
plot(t(1:6001),real(x(1:6001,2)),'r:',t(1:6001),real(y(1:6001)));
xlabel('Time'); ylabel('Amplitude');
legend('Original','Beamformed');
title('MVDR Beamformer');
% Plot response pattern for five bands
% figure;
% plotResponse(h,subbandfreq(1:5).',c,'Weights',w(:,1:5));
% legend('location','SouthEast')

4 Comments

here is the error: Undefined function or variable 'Property'.
Error in TimeDomain32 (line 33) hbf = phased.TimeDelayBeamformer('SensorArray',h,...
Impossible to understand that code
  • h = phased.ConformalArray();
  • t= 1/2*(1+sqrt(14));
  • n=32;
  • c= ones(n,1)';
  • c(:)=1:32;
  • h.ElementPosition = [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;(sqrt(c).*cos(2*pi*t*c))*0.02655;(sqrt(c).*sin(2*pi*t*c))*0.02655];
  • 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;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]);
  • % sampling rate fs= 999e3;
  • t=0:1/20e6:3e-4;
  • c = 343;
  • fc = 500000; % Operating frequency
  • hc = phased.WidebandCollector('Sensor',h,... 'PropagationSpeed',c,'SampleRate',fs,... 'ModulatedInput',true,'CarrierFrequency',fc);
  • A=1:32;
  • B=1:32;
  • A(A>0)=-1.5708;
  • B(B>0)=1.5508;
  • ang=[A;B];
  • x=step(hc,recon,ang);
  • % Beamforming
  • hbf = phased.TimeDelayBeamformer('SensorArray',h,... 'DirectionSource',Property,'Direction',ang,... 'PropagationSpeed',c,... 'SampleRate',fs,'SubbandsOutputPort',true,... 'WeightsOutputPort',true);
  • [y,w] = step(hbf,x);
  • figure;
  • % Plot signals
  • plot(t(1:6001),real(x(1:6001,2)),'r:',t(1:6001),real(y(1:6001)));
  • xlabel('Time');
  • ylabel('Amplitude');
  • legend('Original','Beamformed');
  • title('MVDR Beamformer');
Hello Mario,
is the code vivid now?

Sign in to comment.

Answers (1)

You need to put quote around it because it supposed to be a string, like this
hbf = phased.TimeDelayBeamformer('SensorArray',h,...
'DirectionSource','Property','Direction',ang,...
'PropagationSpeed',c,...
'SampleRate',fs,'SubbandsOutputPort',true,...
'WeightsOutputPort',true);
BTW I responded your comments in the other thread. Sorry for the delay.
HTH

7 Comments

Thank you so much for your Response. According to my Signal, my direction should be also 2*32 but MATLAB says that it has to be of size 2*1. And when I Change the direction to 2*1, it says that the direction should match the Signal, means 2*32. Here is the error:
Error using Beamformer
Expected Direction to be of size 2x1 when it is actually size 2x32.
Error in sigdatatypes.validateAzElAngle (line 29)
validateattributes(x,{'double'},varargin{:},funcname,varname);
Error in phased.internal.AbstractBeamformer/set.Direction (line 54)
sigdatatypes.validateAzElAngle(val,'Beamformer',...
Error in C:\Program Files\MATLAB\R2013a\toolbox\matlab\system\+matlab\+system\pvParse.p>pvParse
(line 25)
Error in C:\Program
Files\MATLAB\R2013a\toolbox\matlab\system\+matlab\+system\SystemProp.p>SystemProp.parseInputs
(line 755)
Error in C:\Program
Files\MATLAB\R2013a\toolbox\matlab\system\+matlab\+system\SystemProp.p>SystemProp.setProperties
(line 203)
Error in phased.internal.AbstractArrayOperation (line 68)
setProperties(obj, nargin, varargin{:});
Error in phased.internal.AbstractBeamformer (line 83)
obj@phased.internal.AbstractArrayOperation(varargin{:});
Error in phased.internal.AbstractTimeDomainBeamformer (line 27)
obj@phased.internal.AbstractBeamformer(varargin{:});
Error in phased.TimeDelayBeamformer (line 97)
obj = obj@phased.internal.AbstractTimeDomainBeamformer(varargin{:});
Error in TimeDomain32 (line 33)
hbf = phased.TimeDelayBeamformer('SensorArray',h,...
>> I get good results when I use different beamformers.
Could you tell me the dimension of recon? I couldn't reproduce the error without that piece of information. thanks.
recon is 6001*32. I have attached it here. thanks.
I didn't use your mat file, but when I thrown in a 6001x32 matrix and set the 'Direction' property to a 2x1 vector, say [0;0], then the script works fine up to
[y,w] = step(hbf,x);
I did need to remove 'SubbandsOutputPort' pair from the beamformer definition line as it is not a property in phased.TimeDelayBeamformer.
Did I miss anything? Thanks.
Thank you for your help. Yes, you are right. I removed 'SubbandOutputPort'. It is still saying that the number of angles must match the number of signals when I set the 'Direction' property to a 2*1 vector. For other beamformers, I always Keep the angles as a 2*32 Matrix and it works very well. Could it be because of the Version of my MATLAB? I use 2013a!
It works fine for me in 2013a too. What are the other beamformers you use? Below is my script, could you give it a try?
h = phased.ConformalArray();
t= 1/2*(1+sqrt(14));
n=32;
c= ones(n,1)';
c(:)=1:32;
h.ElementPosition = [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;(sqrt(c).*cos(2*pi*t*c))*0.02655;(sqrt(c).*sin(2*pi*t*c))*0.02655];
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;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]);
% sampling rate
fs= 999e3;
t=0:1/20e6:3e-4;
c = 343;
fc = 500000; % Operating frequency
hc = phased.WidebandCollector('Sensor',h,...
'PropagationSpeed',c,'SampleRate',fs,...
'ModulatedInput',true,'CarrierFrequency',fc);
A=1:32;
B=1:32;
A(A>0)=-1.5708;
B(B>0)=1.5508;
ang=[A;B];
recon = randn(6001,32)+1i*randn(6001,32);
x=step(hc,recon,ang);
% Beamforming
hbf = phased.TimeDelayBeamformer('SensorArray',h,...
'DirectionSource','Property','Direction',[0;0],...
'PropagationSpeed',c,...
'SampleRate',fs,...
'WeightsOutputPort',true);
[y,w] = step(hbf,x);
Thank you so much. It is working now. the Problem was regarding the Direction which I set to 'ang'. It has to be exactly the variables : [0;0].

Sign in to comment.

Asked:

on 24 Jan 2017

Commented:

on 1 Feb 2017

Community Treasure Hunt

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

Start Hunting!