help-octave
[Top][All Lists]

## using fft to resample data

 From: mat Subject: using fft to resample data Date: Fri, 7 Oct 2016 04:48:26 -0700 (PDT)

```Hi,

I've got some frequency domain data which I want to process in the time
domain then return to the freq domain for plotting. I want to upsample the
input (sig) data to N_FFT length, and plot it against a new frequency vector
as in 'y' below. The fft function seems to pad the data with zeros rather
than upscale it (like Matlab does?). I'm doing some convolution in the time
domain so fft'ing by the original length(sig) as in 'x', feels like it would
lose data.

Sorry my maths isn't great....I may have just confused myself here.

Example code:

N_FFT = 16384;

sig = rand(1,100);
freq = (1:1:100);

xt = ifft(sig,length(sig));

x = fft(xt,length(sig));

yt = ifft(sig,N_FFT);

y = fft (yt,N_FFT);

freq1 = (1:(max(freq)-1)/N_FFT:max(freq)-((max(freq)-1)/N_FFT));

figure;
semilogx(abs(xt),'r');
hold on;
semilogx(abs(yt),'b');

figure;
plot(freq,real(x),'y');
hold on
plot(freq,sig,'b');
plot(freq,real(y(1:100)),'r');
%plot(freq1,real(y),'r');

Best regards,

Mat.

--
View this message in context:
http://octave.1599824.n4.nabble.com/using-fft-to-resample-data-tp4680038.html
Sent from the Octave - General mailing list archive at Nabble.com.

```