Code covered by the BSD License  

Highlights from
Exercises in Advanced Risk and Portfolio Management

from Exercises in Advanced Risk and Portfolio Management by Attilio Meucci
text and comments on solutions available at http://symmys.com/node/170

S_Toeplitz.m
% this script shows that the eigenvectors of a Toplitz matrix have a Fourier basis structure
% see "Risk and Asset Allocation"-Springer (2005), by A. Meucci

close all; clear; clc;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
N=200; % dimension of the matrix
Decay=.9;      % decay factor

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
T=eye(N);
for n=1:N-1
    T=T+Decay^n*(diag(ones(N-n,1),n)+diag(ones(N-n,1),-n));
end
[EigVect,EigVals]=eig(T);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
figure
for n=N-1:N
    hold on
    h=plot(EigVect(:,n));
    set(h,'color',[rand() rand() rand()]);
end
grid on

Contact us at files@mathworks.com