%% 2-D Inverse Transform of Matrix
% You can use the ifft2 function to convert 2-D signals sampled in frequency to signals sampled in time or space.  The ifft2 function also allows you to control the size of the transform.
% Create a 3-by-3 matrix and compute its Fourier transform.

X = magic(3)

%

Y = fft2(X)

%
% Take the inverse transform of Y, which is the same as the original matrix X, up to round-off error.

ifft2(Y)

%
% Pad both dimensions of Y with trailing zeros so that the transform has size 8-by-8.

Z = ifft2(Y,8,8);
size(Z)

% Copyright 2012 The MathWorks, Inc.