ip_07_07.m

来自「MATLAB通信系统仿真(程序库)」· M 代码 · 共 36 行

M
36
字号
% MATLAB script for Illustrative Problem 7, Chapter 7. echo onTb=1;f1=1000/Tb;f2=f1+1/Tb;phi=pi/4;N=5000;   				% number of samplest=0:Tb/(N-1):Tb;u1=cos(2*pi*f1*t);u2=cos(2*pi*f2*t);% assuming that u1 is transmitted, the received signal r issgma=1;					% noise variancefor i=1:N,  r(i)=cos(2*pi*f1*t(i)+phi)+gngauss(sgma);  echo off;end;echo on ;% the correlator outputs are computed nextv1=sin(2*pi*f1*t);v2=sin(2*pi*f2*t);r1c(1)=r(1)*u1(1);r1s(1)=r(1)*v1(1);r2c(1)=r(1)*u2(1);r2s(1)=r(1)*v2(1);for k=2:N,  r1c(k)=r1c(k-1)+r(k)*u1(k);  r1s(k)=r1s(k-1)+r(k)*v1(k);  r2c(k)=r2c(k-1)+r(k)*u2(k);  r2s(k)=r2s(k-1)+r(k)*v2(k);  echo off;end;echo on;% decision variablesr1=r1c(5000)^2+r1s(5000)^2;r2=r2c(5000)^2+r2s(5000)^2;% plotting commands follow

⌨️ 快捷键说明

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