Bootstrap

matlab 产生循环矩阵,matlab循环矩阵 转载

参考:http://www.ilovematlab.cn/thread-101148-1-1.html

这个ok:

clc;clear; h = [10 9 8 7 6 5 4 3 2 1];

size=length(h);

t=zeros(1,size);

t(1)=h(1);

t(1,2:size)=h(size:-1:2);

H=toeplitz(h,t)

这个也ok:

clc;clear;

h = [10 9 8 7 6 5 4 3 2 1];

size = length(h);

newh = zeros(size,size);

newh(1,1) = h(1);

newh(1,2:size) = h(size:-1:2);

for i = 2:size

newh(i,1) = newh(i-1,size);

newh(i,2:size) = newh(i-1,1:9);

end

这个也ok:

clear;

clc;

a = [1 1 1 2 2 2 3 3 3 4 4 4 5 5 5 6 6 6 7 7 7 8 8 8];

h = [a;a;a];

%function producematrix(h,m)

[height width] = size(h);

m = 3;

c = cell(1,width/m);

for i = 1:m:width

c{(i+m-1)/m} = b(1:m,i:i+m-1);

end

newc = cell(length(c),length(c));

newc{1,1} = c{1};

for i = 2:length(c)

newc{1,i} = c{length(c)-i+2};

end

for i = 2:length(c)

newc{i,1} = newc{i-1,length(c)};

for j = 2:length(c)

newc{i,j} = newc{i-1,j-1};

end

end

%h和m是你的输入,m是h中构成方阵的大小;

对角化:

[V, D]= eig(newh) D=inv(V)*newh*V

;