TO DISPLAY HISTOGRAM PLOT OF RAYLEIGH ENVELOPE AND UNIFORM PHASE AND CALCULATING LCR AND AFD

TO DISPLAY HISTOGRAM PLOT OF RAYLEIGH ENVELOPE AND UNIFORM PHASE AND CALCULATING LCR AND AFD
143.0 次下载
更新时间 2015/5/14

查看许可证

clc;
clear all;
close all;

% description of the values

N=100;
d=input('enter the velocity in km/hr ');
fc=input('enter the carrier frequency in hz');

% finding doppler frequency

v=d*5/18;
lambda=(3*(10^8))/fc;
vmax=v/lambda;

% definig 8000 samples

s= 8000;
Ts=1/s;
t=0:2*Ts:2;

% rayleigh pdf for comparison

r=0:0.01:3.5;
q=raylpdf(r,0.7);

% uniform pdf for comparison

l= -3.5:0.1:3.5;

% envelope of inphase and qudrature

a=length(t);
r_I=zeros(1,a);
r_Q=zeros(1,a);
b=sqrt(N);

for k=1:N
theta=rand*360;
phi=rand*360;
r_I=r_I+(randn*cos(2*pi*vmax*cos(theta)*t+phi)*(1/b));
r_Q=r_Q+(randn*sin(2*pi*vmax*cos(theta)*t+phi)*(1/b));
end
z=(r_I+1i*r_Q);
x=abs(z);
y=10*log(x);

% phase

psi=atan(r_Q./r_I);

% LCR and ADF

w=10^-0.3;
rms=sqrt(mean(x.^2));
wh=w/(sqrt(2)*rms);
df=(vmax*2);
T=1/df;
c1=0;
c2=0;


for j=1:length(x)
if x(j) > w
c1=c1+1;
end

if x(j) < w
c2=c2+1;
end
end

LCR_n =((c1/2)/(T*s))+1/2;
AFD_n=((c2*Ts)/2)/LCR_n;

% LCR and AFD theoretical

LCR_t=sqrt(2*pi)*vmax*wh*exp(-(wh^2));
AFD_t=(exp(wh^2)-1)/(wh*vmax*sqrt(2*pi));



% DISPLAY

display(lambda);
display(LCR_n);
display(LCR_t);
display(AFD_n);
display(AFD_t);


% plotting of fading envelope in dB

figure(1);
plot(t,y);
title('ENVELOPE IN dB vs TIME');
xlabel('TIME IN SECONDS');
ylabel('ENVELOPE IN dB');

% plotting of fading envelope and comparing it with Rayleigh

figure(2);
[f,c]=hist(x,50);
bar(c,f/trapz(c,f),'g');
hold on
plot(r,q,'b');
hold off
title('ENVELOPE HISTOGRAM COMPARISON WITH RAYLEIGH');
ylabel('ENVELOPE AND RAYLEIGH');

% plotting of phase and comparing it with uniform

figure(3);
[g,p]=hist(psi,20);
bar(p,g/trapz(p,g),'g');
hold on
plot(l, unifpdf(l, -1.5,1.5),'r');
hold off
title('PHASE HISTOGRAM COMPARISON WITH UNIFORM');
ylabel('PHASE AND UNIFROM');

引用格式

raghav khandelwal (2025). TO DISPLAY HISTOGRAM PLOT OF RAYLEIGH ENVELOPE AND UNIFORM PHASE AND CALCULATING LCR AND AFD (https://www.mathworks.com/matlabcentral/fileexchange/50853-to-display-histogram-plot-of-rayleigh-envelope-and-uniform-phase-and-calculating-lcr-and-afd), MATLAB Central File Exchange. 检索时间: .

MATLAB 版本兼容性
创建方式 R2009b
兼容任何版本
平台兼容性
Windows macOS Linux
类别
Help CenterMATLAB Answers 中查找有关 Histograms 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
版本 已发布 发行说明
1.0.0.0