Note: I colored the Matrix 8 * 8 and 16 * 16 lines in the 24 * 24 matrix to clarify their boundaries and also make clear what I mean exactly.
How do I find a correlation between two matrices?
3 ビュー (過去 30 日間)
古いコメントを表示
I have this code whose output is three matrices, the first is 8 * 8, the second is 16 * 16, and the third is 24 * 24. Now I need to do a function that performs a reciprocal relationship between first: 8 * 8 and 24 * 24 matrices, and this relationship is within the limits of the Matrix 8 * 8, and I explained this in the two attached files. Second: Between 16*16 and 24*24 are matrices, and this relationship is performed within the limits of the 16*16 Matrix. More details, that is, I have the output for the 8 * 8 matrix and the output for the 24 * 24. Look at the numbers in both matrices, taking into account the limits of the 8 * 8 matrix, and then decide how to write the function for this case, as well as the same words for 16 * 16 with The 24*24 . We notice that both the 8 * 8 and 16 * 16 matrix are inside the 24 * 24
the code :
function [idx,x] = chaoticInterleaver(N)
assert(mod(N,8)==0,'N must be divisible by 8.')
idx = zeros(N);
x = N * (0:N-1).' + (1:N); % from Jan
% Lower part
idx(N-7:2:end-1, :) = frf(x(1:N/2, 1:8), N);
idx(N-6:2:end,:) = frf(x(N/2+1:end,1:8), N);
if N >= 16
for ii = 1:4 % Upper part
idx(ii:4:N-8,:) = frf( x(N/4*(ii-1)+1:N/4*ii, 9:end), N);
end
end
end
function out = frf(partX,N)
% flipud, reshape with N rows, and then flip again (hence the name frf).
out = flipud(reshape(flipud(partX),N,[]).');
end
the out put of matrix 8*8 is :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857130/image.png)
the output of 16*16 matrix is :
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857135/image.png)
the output of matrix 24*24 is : We notice that both the 8 * 8 and 16 * 16 matrix are inside the 24 * 24
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/857140/image.png)
3 件のコメント
yanqi liu
2022 年 1 月 10 日
yes,sir,may be interp or upsample and dowsample to get the same size matrix,then use corr2 to compute
回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Creating and Concatenating Matrices についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!