Home > classes > @ao > ifft.m

ifft

PURPOSE ^

IFFT overloads the ifft operator for Analysis objects.

SYNOPSIS ^

function varargout = ifft(varargin)

DESCRIPTION ^

 IFFT overloads the ifft operator for Analysis objects.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

 DESCRIPTION: IFFT overloads the ifft operator for Analysis objects.

 CALL:        b = ifft(a, pl)

 PARAMETERS:
              'type'    - symmetric or nonsymmetric [default: 'symmetric']
              'twoside' - generate a two-sided spectrum from the single
                          sided input. Specify 'yes' or 'no' [default: yes].

 M-FILE INFO: Get information about this methods by calling
              >> ao.getInfo('ifft')

              Get information about a specified set-plist by calling:
              >> ao.getInfo('ifft', 'None')

 VERSION:     $Id: ifft.m,v 1.8 2008/08/15 11:45:19 ingo Exp $

 HISTORY:     26-05-08 M Hewitson
                 Creation

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 % IFFT overloads the ifft operator for Analysis objects.
0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0003 %
0004 % DESCRIPTION: IFFT overloads the ifft operator for Analysis objects.
0005 %
0006 % CALL:        b = ifft(a, pl)
0007 %
0008 % PARAMETERS:
0009 %              'type'    - symmetric or nonsymmetric [default: 'symmetric']
0010 %              'twoside' - generate a two-sided spectrum from the single
0011 %                          sided input. Specify 'yes' or 'no' [default: yes].
0012 %
0013 % M-FILE INFO: Get information about this methods by calling
0014 %              >> ao.getInfo('ifft')
0015 %
0016 %              Get information about a specified set-plist by calling:
0017 %              >> ao.getInfo('ifft', 'None')
0018 %
0019 % VERSION:     $Id: ifft.m,v 1.8 2008/08/15 11:45:19 ingo Exp $
0020 %
0021 % HISTORY:     26-05-08 M Hewitson
0022 %                 Creation
0023 %
0024 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0025 
0026 function varargout = ifft(varargin)
0027 
0028   % Check if this is a call for parameters
0029   if utils.helper.isinfocall(varargin{:})
0030     varargout{1} = getInfo(varargin{3});
0031     return
0032   end
0033 
0034   import utils.const.*
0035   utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename);
0036   
0037   % Collect input variable names
0038   in_names = cell(size(varargin));
0039   for ii = 1:nargin,in_names{ii} = inputname(ii);end
0040 
0041   % Collect all AOs and plists
0042   [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names);
0043   pl              = utils.helper.collect_objects(varargin(:), 'plist', in_names);
0044 
0045   % Decide on a deep copy or a modify
0046   bs = copy(as, nargout);
0047 
0048   % combine plists
0049   pl = combine(pl, getDefaultPlist());
0050 
0051   % two-sided or one?
0052   type    = find(pl, 'type');
0053   twoside = find(pl, 'twoside');
0054 
0055   % Check input analysis object
0056   for j=1:numel(bs)
0057     switch class(bs(j).data)
0058       case {'fsdata'}
0059         if strcmpi(twoside, 'YES')
0060           y = [bs(j).data.y bs(j).data.y(end-1:-1:2)];
0061         else
0062           y = bs(j).data.y;
0063         end
0064         % make a new fsdata object
0065         y    = ifft(y, type);
0066         % compute time axis
0067         N   = length(y);
0068         x   = linspace(0, (N-1)/bs(j).data.fs, N);
0069         fsd = tsdata(x, y);
0070         fsd.setXunits('s');
0071         fsd.setYunits('empty');
0072 
0073         % Set data
0074         bs(j).data = fsd;
0075         % Set name
0076         bs(j).setName(sprintf('ifft(%s)', ao_invars{j}), 'internal');
0077         % Add history
0078         bs(j).addHistory(getInfo, pl, ao_invars(j), bs(j).hist);
0079 
0080       case {'tsdata', 'cdata', 'xydata'}
0081         error('### I don''t work for time-series, constant or x/y data.');
0082       otherwise
0083         error('### unknown data type.')
0084     end
0085   end
0086 
0087   % Set output
0088   if nargout > 0
0089     varargout{1} = bs;
0090   end
0091 end
0092 
0093 %--------------------------------------------------------------------------
0094 % Get Info Object
0095 %--------------------------------------------------------------------------
0096 function ii = getInfo(varargin)
0097   if nargin == 1 && strcmpi(varargin{1}, 'None')
0098     sets = {};
0099     pl   = [];
0100   else
0101     sets = {'Default'};
0102     pl   = getDefaultPlist;
0103   end
0104   % Build info object
0105   ii = minfo(mfilename, 'ao', '', 'Signal Processing', '$Id: ifft.m,v 1.8 2008/08/15 11:45:19 ingo Exp $', sets, pl);
0106 end
0107 
0108 %--------------------------------------------------------------------------
0109 % Get Default Plist
0110 %--------------------------------------------------------------------------
0111 function pl_default = getDefaultPlist()
0112   pl_default = plist('type', 'symmetric', 'twoside', 'yes');
0113 end
0114 
0115

Generated on Mon 25-Aug-2008 22:39:29 by m2html © 2003