Interference suppression in DSSS(Direct sequence spread spectrum) using kalman filter

2 vues (au cours des 30 derniers jours)
I have written this code for interference suppression in direct sequence spread spectrum using the kalman filter.
please guide me what is the problem in my code that how can i get the desire result.
clc
clear all
close all
% Generating the bit pattern with each bit 8 samples long
b=round(rand(1,2000));
pattern=[];
for k=1:200
if b(1,k)==0
sig=zeros(1,10);
else
sig=ones(1,10);
end
pattern=[pattern sig];
pattern1=pattern';
len=length(pattern1);
end
plot(pattern1);
axis([-1 2020 -.5 1.5]);
title('\bf\it Original Bit Sequence1');
%%%Generating pseudorandom binary sequence
%%
seq = ltePRBS(1,len)';
seq(1:len);
len1=length(seq);
figure
stairs(seq);
axis([-1 2000 -0.5 1.5]);
title('Pseodu random pattern');
%Multiplaying the pseudo sequence and massage signal
bbs=zeros(1,2000);
for i=1:len
bbs(:,i)= pattern1(i).*seq(i);
end
figure
stairs(bbs,'linewidth', 2);axis([-1 2000 -.5 1.5]);
title('Pseodu random pattern*bit sequence');
% Generating noise
noise1=sqrt(0.1)*randn(1,2000);
figure
plot(noise1);
axis([-1 2020 -1.5 1.5]);
title('Noise');
%Generating the interference
phi1=1.98;
phi2=-0.9801;
samples = 2000;
e = randn(1,samples); % e(k)=white gaussian noise with variance 0.01
v = var(e); % check variance
v_target = 0.01;
amp = sqrt(v_target/v); % compute amplitude factor correction to get target variance
e = e*amp;
v = var(e) % now we have the correct variance
% init I
I(1) = e(1); % ....i(-1),i(-2)......<0 are equal to zero
I(2) = phi1*I(1)+ 0 +e(2);
% main loop
for k=3:samples
I(k) = phi1*I(k-1)+phi2*I(k-2)+e(k);
end
figure
plot(I)
title('correlated interference');
%adding noise interference and pseudo sequence to get the resultant signal
z=noise1+bbs+I;
figure
plot(z)
title('desired signal');
%%
%APPLY THE CONDITION
phi=[1.98 -0.9801
1 0];
sig_u=0.01;
Q=[sig_u 0
0 sig_u];
M(:,:,1)=2000*eye(2);% M[-1,-1]
H(:,:,1)=[1 0];
sig_w=0.1; % variance
%I_post(:,1)=[0;0]; %I[-1|-1]
I_post=zeros(2,2000);% h[n|n]
I_pre=zeros(2,2000); %h[n|n-1]
M=zeros(2,2,2000); %M[n|n]
M_pre=zeros(2,2,2000);
K = zeros(2,1,2000);
for k=1:2000
if (z(k)-I(k)+1).^2>=(z(k)-I(k)-1).^2;
bbs(k)=1;
elseif (z(k)-I(k)+1).^2<(z(k)-I(k)-1).^2;
bbs(k)=-1;
else
bbs(k)=0;
end
I_post(:,k)=z(k)-bbs(k);
%apply the kalman fiter
I_pre(:,k)=phi*I_post(:,k);
M_pre(:,:,k)=phi*M(:,:,1)*phi'+Q;
%apply thekalman gain
K(:,:,k)=((M_pre(:,:,k)*H')/((sig_w)+H*M_pre(:,:,k)*H')).^1;
%Minimam correctin MSE
I_post(:,k)=I_pre(:,k)+K(:,:,k)*(z(:,k)-H*I_pre(:,k));
%Minimam correction
M(:,:,k)=(eye(2)-K(:,:,k)*H)*M_pre(:,:,k);
end
figure
plot(bbs)
axis([-1 2000 -1.5 1.5]);
title('subtrated sequence');
SINR=zeros(1,2000);
SINR1=zeros(1,2000);
SINR2=zeros(1,2000);
for k1=1:1000
SINR(:,k1)=sum(bbs(k1)^2)/sum(mode(z(k1)-bbs(k1)^2));
del(:,k1)=z(k1)-H*I_post(:,k1);
%output SINR
SINR1(:,k1)=sum(bbs(k1)^2)/sum(mode(del(k1)-bbs(k1)^2));
%SINR improvement
SINR2(:,k1)=sum(mode(z(k1)-bbs(k1)^2))/sum(mode(del(k1)-bbs(k1)^2));
end
figure
t=20*log10(SINR);
hold on
t1=20*log10(SINR2);
hold off
%plot(t,t1)
plot(t,t1)
%axis([-20 -5 10 60]);
how can i get the result in fig given below by using above code.please guide me.

Réponses (0)

Produits


Version

R2015a

Community Treasure Hunt

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

Start Hunting!

Translated by