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

📄 用jacks 方法产生瑞利衰落.m

📁 这是个扩频系统中的PN码仿真程序
💻 M
字号:
% function Raydata=rayleigh2(fd,fs,ns) 
% ray2.m 
%由 jacks方法产生的瑞利衰落
% Rayleigh fading simulator.
% Uses Jakes method of the summation of weighted quadrature sinusoids.
%
%此程序为正确程序
% Richard Wyrwas, 2 February 1995.
% plot labels added by Bill Cowley  4/97
%disp('ray2: Jakes method: calculating weighted quadrature sinusoids  ....');
%disp('      with Fs =1kHz ');

clc;clear;
j=sqrt(-1);
fd=1.0; %Max Doppler frequency in Hz
fs=14400;	%Sample Frequency
ns=30000; 	%Number of samples
R=zeros(ns,1);
Mag=zeros(ns,1);
sum=0;
for x=1:ns
      tm=x/fs;
      I=0.0;
      I=1.848*cos(0.983*2*pi*fd*tm);
      I=I+1.414*cos(0.932*2*pi*fd*tm);
      I=I+0.765*cos(0.850*2*pi*fd*tm);
      I=I+0.0*cos(0.739*2*pi*fd*tm);
      I=I-0.765*cos(0.603*2*pi*fd*tm);
      I=I-1.414*cos(0.446*2*pi*fd*tm);
      I=I-1.848*cos(0.247*2*pi*fd*tm);
      I=I-2.000*cos(0.092*2*pi*fd*tm);
      I=I+1.000*cos(1.000*2*pi*fd*tm);

      Q=0.0;
      Q=Q+0.765*cos(0.983*2*pi*fd*tm);
      Q=Q+1.414*cos(0.932*2*pi*fd*tm);
      Q=Q+1.848*cos(0.850*2*pi*fd*tm);
      Q=Q+2.000*cos(0.739*2*pi*fd*tm);
      Q=Q+1.848*cos(0.603*2*pi*fd*tm);
      Q=Q+1.414*cos(0.446*2*pi*fd*tm);
      Q=Q+0.765*cos(0.247*2*pi*fd*tm);
      Q=Q+0.000*cos(0.092*2*pi*fd*tm);
      Q=Q+1.000*cos(1.000*2*pi*fd*tm);
     
      
      R(x) = 0.126*I+j*Q*0.126;
      Mag(x)=abs(R(x));
      sum=sum+Mag(x).^2;
end;
% figure(2);
avera=sum/ns;
Raydata=R./avera;
absofRaydata=mean(abs(Raydata).^2);
Raydata=Raydata./sqrt(absofRaydata);
% save e:\temp R
plot(Mag);
title('Plot of Simulated Signal Magnitude versus sample number')
% axis([10,30000,0,2]);

⌨️ 快捷键说明

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