Matlab:如何将矩阵转换为Toeplitz矩阵 [英] Matlab: How to convert a matrix into a Toeplitz matrix
问题描述
考虑离散动力系统,其中x[0]=rand()
表示系统的初始条件.
Considering a discrete dynamical system where x[0]=rand()
denotes the initial condition of the system.
我通过以下步骤生成了一个m×n矩阵-生成m
个具有m
个不同初始条件的向量,每个初始条件的维数为N
(N表示样本或元素的数量).该矩阵称为R.如何使用R创建Toeplitz矩阵T
? Ť
在数学上,
I have generated an m by n matrix by the following step -- generate m
vectors with m
different initial conditions each with dimension N
(N indicates the number of samples or elements). This matrix is called R. Using R how do I create a Toeplitz matrix, T
? T
Mathematically,
R = [ x_0[0], ....,x_0[n-1];
..., ,.....;
x_m[0],.....,x_m[n-1]]
toeplitz矩阵T
=
The toeplitz matrix T
=
x[n-1], x[n-2],....,x[0];
x[0], x[n-1],....,x[1];
: : :
x[m-2],x[m-3]....,x[m-1]
我尝试使用toeplitz(R)
,但是尺寸发生了变化.从数学角度看,尺寸应该没有变化.
I tried working with toeplitz(R)
but the dimension changes. The dimension should no change, as seen mathematically.
推荐答案
根据提供的论文(Yu等人的用于压缩感测的Toeplitz结构混沌感测矩阵),有两个混沌感测矩阵涉及.让我们分别探讨它们.
According to the paper provided (Toeplitz structured chaotic sensing matrix for compressive sensing by Yu et al.) there are two Chaotic Sensing Matrices involved. Let's explore them separately.
- 混沌感测矩阵( A 部分)
很明显,要创建这样的矩阵,您必须使用m
个不同的初始条件(范围为[0; 1 [])构建m
个独立的信号(序列),然后每行连接这些信号(即,一个信号=一行).这些信号中的每一个都必须具有长度N
.这实际上是您的矩阵R
,它已按原样正确评估.尽管我想提出一个代码改进建议:您可以直接在每行中构建这样的矩阵,而不是先构建一列然后转置矩阵:
It is clearly stated that to create such matrix you have to build m
independent signals (sequences) with m
different initials conditions (in range ]0;1[) and then concatenate such signals per rows (that is, one signal = one row). Each of these signals must have length N
. This actually is your matrix R
, which is correctly evaluated as it is. Although I'd like to suggest a code improvement: instead of building a column and then transpose the matrix you can directly build such matrix per rows:
R=zeros(m,N);
R(:,1)=rand(m,1); %build the first column with m initial conditions
请注意:通过运行randn()
,您选择具有高斯(正态)分布的值,这些值可能不在论文所述的[0; 1]范围内(在等式9的正下方) ).相反,通过使用rand()
,您可以在此范围内获取均匀分布的值.
Please note: by running randn()
you select values with Gaussian (Normal) distribution, such values might not be in range ]0;1[ as stated in the paper (right below equation 9). As instead by using rand()
you take uniformly distributed values in such range.
之后,您可以根据for循环分别构建每一行:
After that, you can build every row separately according to the for-loop:
for i=1:m
for j=2:N %skip first column
R(i,j)=4*R(i,j-1)*(1-R(i,j-1));
R(i,j)=R(i,j)-0.5;
end
end
- Toeplitz混沌传感矩阵(部分 B )
在 B 节的开头明确指出,要构建Toeplitz矩阵,您应该考虑具有给定,单个初始条件的单个序列x
.因此,让我们构建这样的序列:
It is clearly stated at the beginning of Section B that to build the Toeplitz matrix you should consider a single sequence x
with a given, single, initial condition. So let's build such sequence:
x=rand();
for j=2:N %skip first element
x(j)=4*x(j-1)*(1-x(j-1));
x(j)=x(j)-0.5;
end
现在,您可以考虑构建矩阵:
Now, to build the matrix you can consider:
- 第一行的样子如何?好吧,它看起来像序列本身,但是翻转了(即不是从 0 变为 n-1 ,而是从 n-1 到 0 )
- 第一列的外观如何?这是
x
中最后一个项目,与范围从 0 到 m-2 的元素连接
- how do the first row looks like? Well, it looks like the sequence itself, but flipped (i.e. instead of going from 0 to n-1, it goes from n-1 to 0)
- how do the first column looks like? It is the last item from
x
concatenated with the elements in range 0 to m-2
然后构建第一行(r
)和第一列(c
):
Let's then build the first row (r
) and the first column (c
):
r=fliplr(x);
c=[x(end) x(1:m-1)];
请注意:在Matlab中,索引从1开始,而不是从0开始(因此,不是从 0 到 m-2 ,我们从 1 转到 m-1 ).另外,end
表示给定数组中的最后一个元素.
Please note: in Matlab the indices start from 1, not from 0 (so instead of going from 0 to m-2, we go from 1 to m-1). Also end
means the last element from a given array.
现在,通过查看toeplitz()
函数的帮助,可以清楚地说明可以通过指定第一行和第一列来构建非平方的Toeplitz矩阵.因此,最后,您可以构建如下矩阵:
Now by looking at the help for the toeplitz()
function, it is clearly stated that you can build a non-squared Toeplitz matrix by specifying the first row and the first column. Therefore, finally, you can build such matrix as:
T=toeplitz(c,r);
如本文所报道的那样,此类矩阵确实具有尺寸m*N
.
Such matrix will indeed have dimensions m*N
, as reported in the paper.
即使作者都称他们为\ Phi,但实际上它们是两个单独的矩阵.
他们不采用贝塔矩阵矩阵的托普利兹(托普利茨矩阵不是某种函数或算符),也不会将贝塔矩阵转化为托普利兹矩阵.
首先,您具有类似Beta的矩阵(即混沌感测矩阵),然后是Toeplitz- 结构化的混沌感测矩阵:这样的 structure 是Toeplitz矩阵的典型特征,即是对角线常数结构(沿对角线的所有元素都具有相同的值).
Even though the Authors call both of them \P they actually are two separate matrices.
They do not take the Toeplitz of the Beta-Like Matrix (Toeplitz matrix is not a function or operator of some kind), neither do they transform the Beta-Like Matrix into a Toeplitz-matrix.
You have the Beta-Like Matrix (i.e. the Chaotic Sensing Matrix) at first, and then the Toeplitz-structured Chaotic Sensing Matrix: such structure is typical for Toeplitz matrices, that is a diagonal-constant structure (all elements along a diagonal have the same value).
这篇关于Matlab:如何将矩阵转换为Toeplitz矩阵的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!