# Problem with Beamforming Implementation in MATLAB

Started by December 16, 2009
hello,

I'm having problems implementing the correct beamforming and don't know
where I'm making mistakes. I think the problem is with the created signal.
What's happening is that the beampattern of the adpative filter and as
well the optimum MVDR filter are putting gains in the interferes and
nulling the signal of interest. And as you can see in the program below I'm
just constraint the unitary gain in the direction of the signal of
interest.

So if anyone could help, I would be very greatful.
Here is the programs I'm using:
Main program:

NS = 200000;             % number of samples
NSENS = 10;              % number of sensors
THETAs = [0;-20;43];        % DOAs
FS = 1000;              % sample frequency
SIG_FREQ = 10;          % signals frequency
NE = 1;                 % number of ensambles
NUSER = length(THETAs); % number of users
% compute the steering vector
M = (0:NSENS-1)';
SV = exp(-j*M*PHI');
% compute CLMS
C = SV(:,1);
f = 1;
P = (eye(NSENS) - C*pinv(C'*C)*C');
F = (C*pinv(C'*C)*f);
MU = 1e-4;              % algoritm step-size
RXX = zeros(NSENS,NSENS,NE);
RXX_T = zeros(NSENS,NSENS);
for k=1:NE
[SIG_OUT,SIG_INT,SIG_INTER] = g_signals(NS,NSENS,THETAs,FS,SIG_FREQ);
OUT = zeros(NS,1);
W1 = zeros(NSENS,NS+1);
W1(:,1) = F;
for kk=1:NS
X = SIG_OUT(:,kk);
OUT(kk) = W1(:,kk)'*X;
W1(:,kk+1) = P*(W1(:,kk) - MU*OUT(kk)'*X) + F;
end
RXX = RXX + (SIG_OUT*SIG_OUT')./NS;
W1o = W1(:,end);
end
RXX_T = RXX./NE+0.0001*eye(NSENS);
Wo = inv(RXX_T)*C*inv(C'*inv(RXX_T)*C)*f;
figure(1)
plot_BP(Wo,NSENS)
hold on
plot_BP(W1o,NSENS,'--k')

----------------
the program that generate the signals, g_signals, is:
function [SIG_OUT,SIG_INT,SIG_INTER] =
g_signals(NS,NSENS,THETAs,FS,SIG_FREQ)
NUSER = length(THETAs); % number of users
% compute the steering vector
M = (0:NSENS-1)';
SV = exp(-j*M*PHI');
% discrete time vector
T = (0:1/FS:(NS-1)/FS)';
% generating signals
SIGNAL_G = exp(j*2*pi*SIG_FREQ*T);
SIG_OUT = zeros(NSENS,NS);
SIG_INT = zeros(NSENS,NS);
SIG_INTER = zeros(NSENS,NS,NUSER-1);
% putting DOA to the signals
TEMP = zeros(NSENS,NS);
SIG_INT = SV(:,1)*SIGNAL_G.';
for k=2:NUSER
SIG_INTER(:,:,k) = SV(:,k)*SIGNAL_G.';
TEMP = TEMP + SIG_INTER(:,:,k);
end
SIG_OUT = awgn(TEMP + SIG_INT,20);   % adding white noise

----------------------------------
the program to plot the beampatterns is:

function beam_pattern(WM,NSENS,type_color)
D = 0:NSENS-1;
u = -pi:0.001:pi;
V2 = exp(-j*D.'*u);
G1 = WM'*V2 ;
u2 = asin(u/pi);
u3 = u2*180/pi;
if (nargin == 2)
type_color='-b';
end
plot(u3,20*log10(abs(G1)),type_color);
title('\bf Gain x DOA','Fontsize',32);
axis([-90 90 -40 10]);
xlabel('\it DOA','Fontsize',20);
ylabel('Beam pattern (dB)','Fontsize',20);

thanks in advance for any help.