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

📄 pr7_31.m

📁 Spread Spectrum and CDMA Principles and Applications 书籍和代码
💻 M
字号:
%Problem 7.31
%Simulation of DS SS modulation-demodulation;

close all; clear all;
f0=2; Tc=50; %carrier frequency and chip durration;
S=[1 1 1 -1 -1 1 -1]; N=length(S); Sov=kron(ones(1,4),kron(S,ones(1,Tc))); %signature, its length and oversampling to cover 4 data bits;
%first part imitates spreading and modulation;
D=[1,-1,1,-1]; Dov=kron(D,ones(1,N*Tc)); %4 bits of random data and its oversampling;
DS=Dov.*Sov; %data-manipulated signature;
t=[0:length(DS)-1]/Tc; %time scale;
ss=DS.*sin(2*pi*f0*t); %DS SS manipulated signal;
mod=[Dov;Sov;DS;ss]; YL={'data D(t)','signature s(t)','D(t)*s(t)','DS signal'}; %preparing ylabels for plotting;
for k=1:4
    subplot(4,1,k);
    plot(t,mod(k,:)); xlim([0,4*N]); ylabel(YL(k)); grid; ylim([-1.2 1.2]); set(gca,'xtick',[0:7:28]); %plotting data, signature, dataXsignature, and DS SS modulated carrier;
end;
xlabel('t/\Delta');
%second part imitates despreading and demodulation;
sds=ss.*Sov; %despreading;
dem=cumsum(sds.*sin(2*pi*f0*t)); sel=dem(N*Tc:N*Tc:end); dem1=sign(sel-[0,sel(1:3)]); %demodulation is done by integration and dump;
dem2=kron(dem1,ones(1,N*Tc)); %to display the demodulated bits;
dmod=[ss;Sov;sds;dem2]; YL={'DS signal','reference s(t)','dsprd sign','dmod data'}; %preparing to plot;
figure;
for k=1:4
    subplot(4,1,k);
    plot(t,dmod(k,:)); xlim([0,4*N]); ylabel(YL(k)); grid; ylim([-1.2 1.2]); set(gca,'xtick',[0:7:28]); %plotting data, signature, dataXsignature, and DS SS modulated carrier;
end;
xlabel('t/\Delta');

⌨️ 快捷键说明

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