function varargout = illegal_function(varargin)

% An illegal function which is not part of LTPDA but works on AOs.
% 


ALGONAME = mfilename;
VERSION  = '$Id: illegal_function.m,v 1.1 2008/02/22 18:41:52 hewitson Exp $';

% Collect input ao's, plist's and ao variable names
in_names = {};
for ii = 1:nargin
  in_names{end+1} = inputname(ii);
end

[as, ps, invars] = collect_inputs(varargin, in_names);

a     = as(1);
d     = get(a, 'data');
dinfo = whos('d');

% make a new fsdata object
nfft = length(d.y);
ft   = fft(d.y);
ft   = ft(1:nfft/2+1);
f    = linspace(0, d.fs/2, length(ft));
fsd = fsdata(f, ft, d.fs);
fsd = set(fsd, 'name', sprintf('illegal_function(%s)', d.name));
fsd = set(fsd, 'xunits', 'Hz');
fsd = set(fsd, 'yunits', '');

% make a new history object
h = history(ALGONAME, VERSION, plist(), [a.hist]);
h = set(h, 'invars', cellstr(invars{1}));

% make output analysis object
b = ao(fsd, h);
b = setnh(b, 'name', sprintf('illegal_function(%s)', invars{1}));


varargout{1} = b;
