Professional Documents
Culture Documents
fc=4e3;
T=20;
% number of samples
nfft = 40*fs/fb ;
hs = spectrum.welch('Hamming',nfft,50);
hso=psdopts(hs);
set(hso, 'Fs', fs, 'SpectrumType','twosided','CenterDC',true);
figure(1);
psd(hs, s, hso);
% time index
t
=[0:length(s)-1].'/fs ;
figure(2);
psd(hs, sm, hso);
% the rcosflt() function computes the raised-cosine filter over the range
% (1-alpha)Fd to (1+alpha)Fd where Fd is the input (data) sampling rate.
sf = rcosflt(b,fb,fs,'',0.5) ;
figure(3);
plot(sf(1:10*fs/fb));
figure(4);
psd(hs, sf, hso);
=[0:length(sf)-1].'/fs ;
sfm = sf.*cos(2*pi*fc*t) ;
figure(5);
psd(hs, sfm, hso);
figure(6);
plot([sm(1000:2000),sfm(1000:2000)]);
% generate the real and imaginary components of the QPSK (actually 4-QAM)
% signal
% use half of the bits for the real and half for the imaginary components
br=b(1:nc) ;
bi=b(nc+1:2*nc);
% raised-cosine filter
sr = rcosflt(br,fb,fs,'',0.5) ;
si = rcosflt(bi,fb,fs,'',0.5) ;
% generate the QPSK signal by quadrature modulating the carrier using the
% real and imaginary components
=[0:length(sr)-1].'/fs ;
sq = sr.*cos(2*pi*fc*t) + si.*sin(2*pi*fc*t) ;
figure(7);
psd(hs, sq, hso);