Diagonal Interpolation/Extrapolation of a 1024 x 30 Matrix
6 views (last 30 days)
Show older comments
Hello everyone,
I have a 2D matrix of spectra, (30 spectra, each being 1024 data points long). The 30 spectra are for various peaks along a 1024-pixel detector. I'm trying to interpolate (for the intermediate pixels) and extropolate (for the exterior pixels beyond the edge measurements) diagonally to get a 1024 x 1024 matrix. Could someone please help me by suggesting the most accurate way of doing this? I'm open to any methods, but I may need a little help with the implimentation. Any help would be greatly appreciated.
3 Comments
John D'Errico
on 23 Feb 2021
Yes, you asked me to answer this question by direct mail. NO I don't do e-mail consulting.
But if all you have are the values of some function at a set of points along the diagonal of an array, then you CANNOT intelligently extapolate that information off the diagonal.
It is not at all clear what you are trying to do, so I cannot know if that is really what you are asking.
Answers (1)
Bjorn Gustavsson
on 24 Feb 2021
What you can try for this is to align the main peaks, using something like this:
[~,idxPeaks] = max(I_spectras,[],2); % Here I assume that I_spectras are 30 x 1024
I_S_shifted = zeros(30,2048);
for i1 = 30:-1:1;
I_S_shifted(i1,1024-idxPeaks(i1)+[1:1024]) = I_spectras(i1,:);
end
imagesc(I_S_shifted)
Then you might get somewhere by interpolating I_S_shifted after which you might reverse-shift the spectras (how easy that is to do depends on how simple the shifts of the peaks are in the first place.) This works under the assumption that the shape of the peaks varies very slowly between neighboring spectra. This might be useful or not, If this is not good enough one might take a further step in scaling the spectra as well to line up additional features, but that's for later.
HTH
1 Comment
See Also
Categories
Find more on Matrices and Arrays in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!