Clear Filters
Clear Filters

How do I find a correlation between two matrices?

2 views (last 30 days)
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 :
the output of 16*16 matrix is :
the output of matrix 24*24 is : We notice that both the 8 * 8 and 16 * 16 matrix are inside the 24 * 24
  3 Comments
yanqi liu
yanqi liu on 10 Jan 2022
yes,sir,may be interp or upsample and dowsample to get the same size matrix,then use corr2 to compute

Sign in to comment.

Answers (0)

Categories

Find more on Loops and Conditional Statements in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!