?? pr3_27.m
字號:
%Problem 3.27
%Simulating antijamming features of spread spectrum signals (barrage
%jammer) in comparison to plain signals;
clear all; close all;
t=[0.001:0.001:2]; N=length(t); %times scales;
fo=25; %signal carrier frequency;
WD=[0,30]; %two deviatiobns of LFM signals;
S=[ones(2,N/2),zeros(2,N/2)].*exp(i*pi*WD'*((t-0.5).^2)); %two rows are two complex envelopes of LFM signals with different deviations;
Sbp=imag(S.*kron(ones(2,1),exp(i*2*pi*fo.*t))); %two LFM bandpass signals;
for k=1:2 %this loop do the same for both signals;
Sk=Sbp(k,:); E=norm(Sk)^2; %fixing one of two signals and calulating its energy;
Sp1=fft(Sk); Sp=abs(Sp1).^2; Sp=Sp(1:100)/E; %signal energy spectrum;
subplot(4,2,k); plot([0:99]/2,Sp); xlabel('fT'); ylabel('signal spectrum'); xlim([0,50]); grid; %plotting signal energy spectrum;
a=find(Sp>max(Sp)/50); m=min(a); m=max(2,m); M=max(a); %finds bounds where signal spectrum is contained;
sig=30*norm(S)/sqrt(M-m+1); En=sig^2*(M-m+1); %variance of noise spectrum linked to the signal level and average noise energy;
SpJ1=normrnd(0,sig,10,M-m+1)+i*normrnd(0,sig,10,M-m+1); %jammer random spectrum;
SpJp=sum(abs(SpJ1).^2)/10; SpJp=[zeros(1,m-1),SpJp,zeros(1,100-M)]; %average power spectrum of a barrage jammer;
subplot(4,2,k+2); plot([0:99]/2,SpJp/En); xlabel('fT'); ylabel('jammer spectrum'); xlim([0,50]); grid; %plotting average power spectrum of barrage jammer;
SpJ=zeros(10,N); SpJ(:,m:M)=SpJ1; SpJ(:,N-M+2:N-m+2)=conj(SpJ1(:,M-m+1:-1:1)); %complete jammer spectrum;
SpY=SpJ+kron(ones(10,1),Sp1); %observation spectrum;
Y=real(ifft(conj(SpY'))); %observation in time domain, real to escape warning about negligable imajinary part;
subplot(4,2,k+4); plot(t,Y); xlabel('t/T'); ylabel('MF inp'); ylim([-5,5]); %plotting observations;
Ymf=filter(Sk(N/2:-1:1),1,[Y(N/2+1:N,:);Y])/(norm(Sk)^2); %observations at the matched filter output, cyclic prefix is used to simulate stationary filtering;
subplot(4,2,k+6); plot(t,Ymf(N/2+1:end,:)); xlabel('t/T'); ylabel('MF out'); ylim([-2.5,2.5]); %plotting observations at the matched filter output;
end;
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -