2D cross correlation between NIR and MIR data

3 次查看(过去 30 天)
Hi everyone, can anyone help me on how to compute a 2D cross correlation analysis please. I have NIR and MIR absorbance dataset I need to peform a cross corrrelation to check for similar trends between the two responses. Can anyone assit me with the code to analyse this please? Thank you
The datasset is a 22 by 12001 NIR and 22 by 13001 MIR.

采纳的回答

Gourab
Gourab 2023-6-7
Hi Doyinsola,
I understand that you want to find the 2D cross-correlation between NIR and MIR data matrices.
The `xcorr2()` function computes the cross-correlation between two 2D arrays, treating one as the reference and the other as the template.
Please refer to the below code snippet on using the `xcorr2()` function.
% Load your NIR and MIR data from file
load('nir_data.mat');
load('mir_data.mat');
% Transpose the NIR and MIR data matrices
nir_data = nir_data.';
mir_data = mir_data.';
% Compute the cross-correlation between the NIR and MIR data
cc = xcorr2(nir_data, mir_data);
% Display the cross-correlation as an image
figure;
imagesc(abs(cc));
colormap('jet');
colorbar;
Please refer to the below documentation link for more information on ‘xcorr2()’ function.
I hope this helps you to resolve the query.
  1 个评论
Doyinsola
Doyinsola 2023-6-7
Thank you, it does. I later find a way to it yesterday and it is exactly same as your answer. Thank you.

请先登录,再进行评论。

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by