?? dsss.m
字號:
% Lab 06
% WiCom_3
% By Kashif Shahzad
% 01-ET-31
% 3rd July 2004
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Direct Sequence Spread Spectrum
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
clc
clear
% Generating the bit pattern with each bit 6 samples long
b=round(rand(1,20));
pattern=[];
for k=1:20
if b(1,k)==0
sig=zeros(1,6);
else
sig=ones(1,6);
end
pattern=[pattern sig];
end
plot(pattern);
axis([-1 130 -.5 1.5]);
title('\bf\it Original Bit Sequence');
% Generating the pseudo random bit pattern for spreading
spread_sig=round(rand(1,120));
figure,plot(spread_sig);
axis([-1 130 -.5 1.5]);
title('\bf\it Pseudorandom Bit Sequence');
% XORing the pattern with the spread signal
hopped_sig=xor(pattern,spread_sig);
figure,plot(hopped_sig);
axis([0 130 -0.5 1.5]);
title('product PN code figure');
% Modulating the hopped signal
dsss_sig=[];
t=[0:100];
fc=.1
c1=cos(2*pi*fc*t);
c2=cos(2*pi*fc*t+pi);
for k=1:120
if hopped_sig(1,k)==0,
dsss_sig=[dsss_sig c1];
else
dsss_sig=[dsss_sig c2];
end
end
figure,plot([1:12120],dsss_sig);
axis([-1 12220 -1.5 1.5]);
title('\bf\it DSSS Signal');
% Plotting the FFT of DSSS signal
figure,plot([1:12120],abs(fft(dsss_sig)))
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -