How can I form a Hankel matrix for the following example?

2 次查看(过去 30 天)
I have 6 separate matrix like R(:,:,1) R(:,:,2) R(:,:,3) R(:,:,4) R(:,:,5) R(:,:,6). Each R contains a 4x4 matrix. for example R(:,:,1)= [0.0479 0.0987 0.1126 -0.0126; 0.0547 0.1128 0.1287 -0.0144; 0.1093 0.2254 0.2573 -0.0288; -0.0118 -0.0243 -0.0278 0.0031]. Now, I want to make a Matrix like H: for p=3 & q=4 where,
H= [R1 R2 R3 Rq;
R2 R3 R4 R(q+1);
Rp R4 R5 R(q+2)]
Here R1=R(:,:,1),R2=R(:,:,2)...so on
*My question:* How can I make H matrix by matlab program if I want to change for p & q like p=6 & q =7 etc.?
Thanks in advance... D. Bhuiyan

采纳的回答

Roger Stafford
Roger Stafford 2014-12-11
Let R be an m x n x r array in which r >= p+q-1 using your definition for p and q. Then do this:
T = reshape(permute(R(:,:,1:p+q-1),[1,3,2]),m*(p+q-1),n);
H = zeros(p*m,q*n);
for k = 1:q
H(:,(k-1)*n+1:k*n) = T((1:p*m)+(k-1)*m,:);
end
  4 个评论
Roger Stafford
Roger Stafford 2014-12-11
I see why the second version doesn't work. It should have been written this way:
T = reshape(R(:,:,1:p+q-1),m,n*(p+q-1)); % <-- Corrected
H = zeros(m*p,n*q);
for k = 1:p
H((1:m)+m*(k-1),:) = T(:,(1:n*q)+n*(k-1));
end
Sorry about that.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Creating and Concatenating Matrices 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by