I have tried to perform sinc interpolation (in 1D) with the following Matlab code:
Fs=8; T=1/Fs; t=0:T:(1-T); f=1; x=sin(2*pi*f*t); up_factor=2; %% Deduce sinc from Fourier domain xp=[zeros(1,5) x zeros(1,5)]; Xp=fft(xp); door1D=abs(xp>0); sinc1D=fftshift(abs(fft(door1D))); %plot(door1D);hold on;plot(fftshift(abs(sinc1D))) %% Interp with sinc in spatial domain x_up=upsample(x,2); %plot(x,'b*');hold on;plot(x_up,'r*'); x_up_interp=conv2(x_up,sinc1D,'same'); figure; plot(x_up_interp./up_factor); hold on; plot(x); hold on; plot(x_up,'r+');
It seems to work (except for ripples due to the Gibbs phenomenon I guess?). However, I worked this out in a "deductive" manner and I dont completely understand the parameters (period/frequency) of the sinc. The approach was to extract the sinc from the fft of the door function. Then use that sinc as if I had computed it beforehand and convolve the upsampled (not yet interpolated) 1D signal with it.
Can someone help me understand it better? How would I built this sinc ? e.g. from the sinc() function of Matlab. And for it to work, I have convolved with abs of sinc cf.
conv2(x_up,sinc1D,'same'); , but this seems strange... can someone explain/develop/correct this ?
REM.:also it is probably badly scaled, but that is another detail