% function yout = vifft(yin)
%
%  Perform an inverse FFT on the VARYING matrix Y.  It is assumed
%  that the YIN is a frequency scale in rad/sec and YOUT is returned 
%  with a time scale in seconds.  The frequency scale is assumed to
%  be monotonic and only the first interval is used to determine
%  the time scale.
%
%  See also:  FFT, IFFT and  VIFFT.

function y = vifft(Y)
if nargin ~= 1,
	disp('usage: y = vifft(Y)')
	return
	end

[type,nr,nc,npts] = minfo(Y);
if type == 'syst',
    error('input is not VARYING or CONSTANT')
    return
    end

if type == 'cons' | npts == 1,
    y = Y;
    return
    end

[Ydat,yptr,w] = vunpck(Y);
winc = w(2) - w(1);
tinc = 2*pi/(winc*npts);
t = [0:tinc:tinc*(npts-1)];

y = [];
for i = 1:nr,
    yrow = [];
    for j = 1:nc
        [Ydat,yptr,w] = vunpck(sel(Y,i,j));
        sisoy = ifft(Ydat);
        sisoy = vpck(sisoy,t);
        yrow = sbs(yrow,sisoy);
        end
    y = abv(y,yrow);
    end
%
% Copyright MUSYN INC 1991,  All Rights Reserved
