필터 지우기
필터 지우기

2D cross correlation between NIR and MIR data

조회 수: 3 (최근 30일)
Doyinsola
Doyinsola 2023년 6월 6일
댓글: Doyinsola 2023년 6월 7일
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개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by