File Exchange

## Level crossing rate (LCR) and average fade duration (AFD)

version 1.0.0.0 (47.9 KB) by
Simulation of Time-Selective Fading Channels

3 Downloads

Updated 05 Jan 2016

View License

Level crossing rate (LCR) and average fade duration (AFD) are two statistics
which describe how the channel changes with time. Although they provide the
same information as channel coherence time and Doppler spread, LCR and AFD
are easier to derive and allow practical measurement.

### Cite As

MOHAMMED ELAMASSIE (2021). Level crossing rate (LCR) and average fade duration (AFD) (https://www.mathworks.com/matlabcentral/fileexchange/54750-level-crossing-rate-lcr-and-average-fade-duration-afd), MATLAB Central File Exchange. Retrieved .

### Comments and Ratings (1)

shivik

Can somone help to correct this code:

clear all;
clc;
DataTbl=readtable('6smaalbasorber10ssweeptimeusedthis.csv');
[Ro,Co]=size(DataTbl);
Data=table2array(DataTbl);
Time=Data(:,1);
S21Mag=Data(:,2);
S21Ang=Data(:,3);

%%% DAta Prep %%%%%%
[Re,Im]=pol2cart(S21Ang,S21Mag);
CmpLx=complex(Re,Im);

ampitude=sqrt((Re .^2)+(Im .^2)); % amplitude value

ampitudedB= 20*log10(ampitude); % amplitude in dB

plot (Time,ampitudedB); %Amplitudein db verus time

%calculation of the average fade duration and level crossing rate

% I need an algorithm that can calculate the AFD and LCR for different RMS
% values from -15up till, 5 and gives me an plot in the end of AFD versus the
% different RMS values and LCR versus different RMS values.

data= ampitudedB; % imported |S21| in dB
TH=[-5: 0.2: 5] ; % threshold in dB below RMS level,
MD=10; % measurement duration in se
Fs=length(data)/MD; % sampling frequency in Hz
d_ref=data-20*log10(rms(10.^(data/20)));
d_fad=d_ref<TH;
num_fad=sum(diff(d_fad)>0);
LCR= num_fad/MD; % in 1 sec
FD=sum(d_fad)/Fs/num_fad; % in sec

##### MATLAB Release Compatibility
Created with R2014a
Compatible with any release
##### Platform Compatibility
Windows macOS Linux

### Community Treasure Hunt

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

Start Hunting!