包络公式参考樊昌信通信原理课本
%% 服从瑞利分布的包络
clear;close all;clc;
fs=10e6; % 采样率,单位:Hz
fc=100e3;
t0=1e-2; % 随机序列长度,单位:s
t=0:1/fs:t0;
n=t0*fs+1;
% sigma是标准差值 sigma^2是方差
% 若X服从(mu,sigma^2)的正态分布 则Y=aX+b服从(a*mu+b, (a*sigma)^2 )
sigma = 2;
rng('shuffle');
Crdm=sigma*randn(1,n);
Srdm=sigma*randn(1,n);
rx=Crdm.*cos(2*pi*fc*t)-Srdm.*sin(2*pi*fc*t);
envlope=sqrt(Crdm.^2+Srdm.^2);
phase=atand(Srdm./Crdm);
figure;
histogram(envlope,'Normalization','pdf');
hold on;
V = 0:0.001:6;
pdf_rayleigh = (V/sigma^2).*exp(-V.^2/(2*sigma^2));
plot(V, pdf_rayleigh,'-');
title('包络的分布');
%% 莱斯分布包络以及相位
clear;close all;clc;
fs=10e6; % 采样率,单位:Hz
fc=100e3;
t0=1e-1; % 随机序列长度,单位:s
t=0:1/fs:t0;
n=t0*fs+1;
% sigma是标准差值 sigma^2是方差
% 若X服从(mu,sigma^2)的正态分布 则Y=aX+b服从(a*mu+b, (a*sigma)^2 )
sigma = 2;A=2;
rng('shuffle');
theta=rand(1,n)*180;
Zc=A*cosd(theta)+sigma*randn(1,n);
Zs=A*sind(theta)+sigma*randn(1,n);
rx=Zc.*cos(2*pi*fc*t)-Zs.*sin(2*pi*fc*t);
envlope=sqrt(Zc.^2+Zs.^2);
phase=atand(Zc./Zs);
figure;
histogram(envlope,'Normalization','pdf');
hold on;
V = 0:0.001:20;
pdf_Rice= (V./sigma.^2).*exp(-(V.^2+A.^2)/(2*sigma^2)).*besseli(0,A.*V./(sigma.^2));
plot(V, pdf_Rice,'-');
title('包络的分布');
注意besseli才是修正的贝塞尔
有的blog写成了besselj,仅仅是贝塞尔