Using interp1 to resample an image, results in NaN values.
Show older comments
Hello all,
I've run into an issue with a assignment I am doing. For this assignment it states: "Now, use an interpolation method (in Matlab®, ‘interp1’) to interpolate, i.e. resample, the spectrum from its original sampling to the linearized k-space sampling." During my tries I have come up with the following:
A = 807.6660554599425;
B = 0.06950484773532092;
C = -7.056743126149048e-6;
D = -3.62624279344136e-11;
N = linspace(1, 1024, 1024);
lambda = A*N.^3 + B*N.^2 + C*N + D;
k_n = (2*pi)./lambda;
max = max(k_n);
min = min(k_n);
maxmin = linspace(max,min,1024);
F_resampled = interp1(raw_plak, maxmin);
F_k = fft(F_resampled);
F4 = log(abs(F_k));
Where A through D are device specific settings and 'raw_plak' is the original image given by:
raw_plak = im2double(imread('plakband.tif'));
When using the interp1 fuction returns an array full of NaN values. What am I doing wrong?
Sorry if this has been answered already, I have looked but could not find an answer to my problem.
With regards.
2 Comments
Star Strider
on 15 Jan 2022
The assignment says to resample a spectrum. (To me, that implies a vector.)
Where does the image (a 2D or 3D array) enter into this?
Thijs Knoop
on 15 Jan 2022
Accepted Answer
More Answers (0)
Categories
Find more on Multirate Signal Processing 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!