⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pr3_26.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem 3.26;
%Simulates antijamming features of spread spectrum signal (band elimination used) against narrow
%band jammer and compares to the ones of plain signals;

clear all; close all;
t=[0:0.001:1.999]; N=length(t); fo=25; fj=fo; %time scales and signal and jammer carrier frequencies; 
WD=[0,40]; %vector of two deviations of LFM signal (for a plain signal WD=0);
S=[ones(2,ceil(N/2)),zeros(2,floor(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;
Fi=2*pi*unidrnd(10,1,10)/10; %random phases for 10 jammer realizations;
Aj=10; %set jammer amplitiude;
JM=Aj*sin(kron(ones(10,1),2*pi*fj*t)+kron(ones(1,N),Fi')); %10 realizations of an unmodulated jammer of carrier frequency fj;
Bj=1; %set rejection bandwidth;
for k=1:2 %the loop do the same for both signals
    subplot(4,2,k); plot(t,Sbp(k,:)); xlabel('t/T'); ylabel('signal'); ylim([-1.2 1.2]); grid;
    M=max(abs(fft(Sbp(k,:)))); %this will be used for convenient plotting of observation spectra;
    Y=kron(ones(10,1),Sbp(k,:))+JM; %10 observations of signal+jammer;
    subplot(4,2,k+2); plot(t,Y); xlabel('t/T'); ylabel('sign+jam'); ylim([-1.5,1.5]*(Aj+1)); %plotting observations;
    Ysp=fft(Y'); Yesp=(abs(Ysp)/M).^2; Yesp=Yesp'; %spectra and energy spectra of observations;
    subplot(4,2,k+4); plot([0:99]/2,abs(Yesp(:,1:100))); xlabel('fT'); ylabel('Enrg Spr'); xlim([0,2*fo]); ylim([-0.2,3.2]); %plotting energy spectra of observations;
    Ysp(2*fj-floor(Bj/2)+1:2*fj+floor(Bj/2)+1,:)=0; Ysp(N-2*fj-floor(Bj/2)+1:N-2*fj+floor(Bj/2)+1,:)=0; %band elimination of spectrum components within Bj;    
    Yrej=real(ifft(Ysp)); %real is used to avoid warning about presense of negligible imaginary part;
    subplot(4,2,k+6); plot(t,Yrej'); ylabel('filter out'); xlabel('t/T'); %plotting waveforms after band rejection;
end;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -