# ifft

Inverse Fast Fourier transform.

## Syntax

x = ifft(f)

x = ifft(f,n)

x = ifft(f,n,dim)

## Inputs

f
The frequency spectrum to be transformed into the time domain.
Type: Complex
Dimension: vector | matrix
n
Size of the ifft.
Default: [] to use the input vector length.
Type: integer
Dimension: scalar
dim
The dimension on which to operate.
Default: first non-singleton dimension.
Type: integer
Dimension: scalar

## Outputs

x
The time domain representation of f.

## Example

ifft of signal with two frequency components.

The example shows how to generate a time domain signal from its frequency domain input. The input is sparse, so the example then shows how to up-sample the result to produce a densely sampled signal.


ft = [0 0 0 0 0 -10i 0 0 6i 0 0 0 -6i 0 0 10i 0 0 0 0];    % frequency domain input
fs = 100;                % sampling frequency
n = 20;	                 % number of samples
ts = 1/fs;               % sampling time interval
time = [0:ts:(n-1)*ts];  % time vector
signal = ifft(ft);       % time signal
plot(time, signal);
hold on;

nn = 200;                % new number of samples
newtime = [0:ts:(nn-1)*ts]*(n/nn);  % new time vector
newsig = ifft(ft,nn);               % new time signal
plot(newtime, newsig);
legend('sparse signal','dense signal');
xlabel('time');
ylabel('amplitude');

The frequency spacing is fs/n = 5 Hz, so both components fall exactly on one of the frequency vector values.