Code covered by the BSD License  

Highlights from
AR(p)

AR(p)

by

 

Autoregressive modeling for fading channel simulation

Autoregressive.m
close all; clear all;
clc;
N=60;
Fd =150;
n=0:N-1;
Tb=1/3000;
FdTb=Fd*Tb;
z=2*pi*FdTb.*n;
pp=[1,2,5,20];
epsilon =0.00000001;
YMatrix1=zeros(1,N);
RxxTh=besselj(0,z);
YMatrix1(1,:)=RxxTh;
t=linspace(0,20,N);
for p=pp
Rxx=toeplitz(RxxTh(1:p))+eye(p)*epsilon;
rxx=RxxTh(2:p+1)';
a=-inv(Rxx)*rxx;
RxxHat(1:p)=RxxTh(1:p);
for i=p+1:N;
RxxHat(i)=-a'*fliplr(RxxHat(i-p:i-1))';
end
YMatrix1(end+1,:)=RxxHat;
end
plot1 = plot(t,YMatrix1'); axis([0 20 -1 1.5]);
set(plot1(1),'LineWidth',2,'LineStyle','--','Color',[0 0 1],...
'DisplayName','Jakes',...
'MarkerSize',6);
set(plot1(2),'Marker','^','LineStyle','--','Color',[1 0 0],...
'DisplayName','AR(1)');
set(plot1(3),'Marker','square','Color',[1 0 1],'DisplayName','AR(2)');
set(plot1(4),'Marker','*',...
'Color',[0.0431372560560703 0.517647087574005 0.780392169952393],...
'DisplayName','AR(5)',...
'MarkerSize',6);
set(plot1(5),'Marker','diamond',...
'Color',[0.450980395078659 0.26274511218071 0.26274511218071],...
'DisplayName','AR(20)');
xlabel('Time(ms)');
ylabel('Auto-correlation');
legend('show');

Contact us