To answer your second question, "How to combine individual imagesc images into one visualization?"
If you have several 2d matrices that you want to overlay and display using imagesc
, I would suggest taking the maximum element.
For example, I generate two 31x31 grids with Gaussians with different mean and variance.
function F = generate2dGauss(mu, Sigma) x1 = -3:.2:3; x2 = -3:.2:3; [X1,X2] = meshgrid(x1,x2); F = mvnpdf([X1(:) X2(:)],mu,Sigma); F = reshape(F,length(x2),length(x1)); end F1 = generate2dGauss([1 1], [.25 .3; .3 1]); F2 = generate2dGauss([-1 -1], [.1 .1; .1 1]);
I can build them with subtitles, as in your example,
figure; subplot(1,2,1); title('Atom 1'); imagesc(F1); subplot(1,2,2); title('Atom 2'); imagesc(F2);
Or I can build a maximum of each element for two grids.
figure; title('Both Atoms'); imagesc(max(F1, F2));
You can also experiment with elementary means, amounts, etc., but, based on the example you give, I think that the maximum will give you the cleanest result.
Possible pros and cons of various functions:
- The maximum will work best if your atoms always have zero background and no negative values. If the background is null-valued, but the atoms also contain negative values, negative values ββcan be covered by the background of other atoms. If your atom overlaps, the higher the higher the value will dominate.
- An average value will make your peaks less high, but can be more intuitive if you overlap atoms.
- Amount will make overlapping areas more valuable.
- If you have non-zero backgrounds, you can also try using logical indexing. You will need to make some decisions about what to do in overlapping areas, but this will make it easier to filter the background.