From 42b66891f69e620deab3b8bc40cb9832faed3d82 Mon Sep 17 00:00:00 2001 From: Helge <47348963+HJZollner@users.noreply.github.com> Date: Fri, 2 Dec 2022 16:01:54 -0500 Subject: [PATCH] [FEATURE REQUEST] - Basis set resolution smaller than data resolution - fit_resampleBasis.m - Simon Added the solution proposed by @fant fixing edge effects for basis sets with smaller resolution and frequency range than the data. --- libraries/FID-A/fitTools/fit_resampleBasis.m | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libraries/FID-A/fitTools/fit_resampleBasis.m b/libraries/FID-A/fitTools/fit_resampleBasis.m index a99d7db4..086670ea 100644 --- a/libraries/FID-A/fitTools/fit_resampleBasis.m +++ b/libraries/FID-A/fitTools/fit_resampleBasis.m @@ -45,7 +45,11 @@ for ll=1:(basisSet.nMets + basisSet.nMM) % Loop over the number of sub-spectra (MEGA, HERMES, HERCULES) for rr = 1:size(basisSet.fids, 3) - specs_interp(:,ll,rr) = interp1(ppmRangeBasis(ppmIsInDataRange), basisSet.specs(ppmIsInDataRange,ll,rr), ppmRangeData, 'pchip', 'extrap'); + if size(ppmRangeData,1) > size(ppmRangeBasis,2) + specs_interp(:,ll,rr) = interp1(ppmRangeBasis(ppmIsInDataRange), basisSet.specs(ppmIsInDataRange,ll,rr), ppmRangeData, 'pchip', 0); + else + specs_interp(:,ll,rr) = interp1(ppmRangeBasis(ppmIsInDataRange), basisSet.specs(ppmIsInDataRange,ll,rr), ppmRangeData, 'pchip', 'extrap'); + end %convert back to time domain %if the length of Fids is odd, then you have to do a circshift of one to %make sure that you don't introduce a small frequency shift into the fids