2D cross correlation between NIR and MIR data

2 vues (au cours des 30 derniers jours)
Doyinsola
Doyinsola le 6 Juin 2023
Commenté : Doyinsola le 7 Juin 2023
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.

Réponse acceptée

Gourab
Gourab le 7 Juin 2023
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 commentaire
Doyinsola
Doyinsola le 7 Juin 2023
Thank you, it does. I later find a way to it yesterday and it is exactly same as your answer. Thank you.

Connectez-vous pour commenter.

Plus de réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by