How zero padding affects DCT of a sequence?
Started by 2 months ago●5 replies●latest reply 2 months ago●124 viewsIf you have matlab you can check that directly. May be Octave also support DCT.
I don't know the answer but can play in Matalb:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
x = randn(1,500)+j*randn(1,500);
y = [dct(x) zeros(1,70)];
td = idct(y);
figure;
plot(abs(fft(x)));
hold
plot(abs(fft(td)),'g--')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
it seems positive frequencies are somehow recovered but the negative looks weird. I leave the conclusion to you.
if you replace dct/idct with fft/ifft you recover your signal
I did do it in MATLAB. It seems both for FFT & DCT the final output somehow represents the original input x. For example, for FFT, the final output td has the scaled version of original input x occurring at a regular interval. But I am not sure how can I explain it mathematically.
As I see it the dct plus zeros followed by idct leads to shift of negative bins by the number of zeros with minor scaling issues.
fft + zeros followed by ifft keeps bins as the original.
x = randn(1,500)+j*randn(1,500);
y = [dct(x) zeros(1,70)];
td = idct(y);
figure;
plot(abs(fft(x)),'*-');
hold
td = fft(td);
td = [td(1:250) td(321:end)];
plot(abs((td))*63/67,'g*--')
How do you differentiate the positive and negative frequencies from the plot? The plot in the R.H.S represents the negative frequency?
for n = 500 as my example:
bin 1 is dc
bins 2:250 are positive frequencies
bins 251:500 are negative frequencies