I will help you on making a dummy normalised co-occurrence matrix as per the image by breaking it down into 2 steps – Computing the co-occurrence matrix followed by visualizing it as a heatmap.
1. Computing the co-occurrence matrix
- Define bins for parameters A and B:
- Loading data: If you have real data, load it from a file (csv, mat, etc.). Assuming you have loaded the data for the 2 parameters in A_data and B_data
- Make Co-occurance matrix using “histcounts2” function
occurrence_matrix = histcounts2(A_data, B_data, A_bins, B_bins);
- Normalize to range [0, 1]
normalized_matrix = occurrence_matrix / max(occurrence_matrix(:));
2. Visualizing the co-occurrence matrix as a heatmap
MATLAB provides multiple functions to plot heatmaps. Kindly follow any one the method mentioned below:
imagesc(A_bins, B_bins, normalized_matrix');
pcolor(A_bins(1:end-1), B_bins(1:end-1), normalized_matrix');
contourf(A_bins(1:end-1), B_bins(1:end-1), normalized_matrix', 20);
Then proceed with labelling the axes accordingly.
For more information on “histcounts2”, Kindly follow the MATLAB documentation:
For more information on displaying heatmaps, kindly refer the following MATLAB documentations: