MDC1_X2ACC converts the input time-series to acceleration with a time-domain filter taking in to account the given spring stiffness. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: MDC1_X2ACC converts the input time-series to acceleration with a time-domain filter taking in to account the given spring stiffness. CALL: o1dd = mdc1_x2acc(o1, pl) PARAMETERS: 'Omega2' - the square of the stiffness term [default: -1.3e-6] M-FILE INFO: Get information about this methods by calling >> ao.getInfo('mdc1_x2acc') Get information about a specified set-plist by calling: >> ao.getInfo('mdc1_x2acc', 'None') VERSION: $Id: mdc1_x2acc.m,v 1.7 2008/09/05 11:05:29 ingo Exp $ HISTORY: 11-04-08 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % MDC1_X2ACC converts the input time-series to acceleration with a time-domain filter 0002 % taking in to account the given spring stiffness. 0003 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0004 % 0005 % DESCRIPTION: MDC1_X2ACC converts the input time-series to acceleration with a time-domain filter 0006 % taking in to account the given spring stiffness. 0007 % 0008 % CALL: o1dd = mdc1_x2acc(o1, pl) 0009 % 0010 % PARAMETERS: 'Omega2' - the square of the stiffness term [default: -1.3e-6] 0011 % 0012 % M-FILE INFO: Get information about this methods by calling 0013 % >> ao.getInfo('mdc1_x2acc') 0014 % 0015 % Get information about a specified set-plist by calling: 0016 % >> ao.getInfo('mdc1_x2acc', 'None') 0017 % 0018 % VERSION: $Id: mdc1_x2acc.m,v 1.7 2008/09/05 11:05:29 ingo Exp $ 0019 % 0020 % HISTORY: 11-04-08 M Hewitson 0021 % Creation 0022 % 0023 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0024 0025 function varargout = mdc1_x2acc(varargin) 0026 0027 % Check if this is a call for parameters 0028 if utils.helper.isinfocall(varargin{:}) 0029 varargout{1} = getInfo(varargin{3}); 0030 return 0031 end 0032 0033 import utils.const.* 0034 utils.helper.msg(msg.MNAME, 'running %s/%s', mfilename('class'), mfilename); 0035 0036 % Collect input variable names 0037 in_names = cell(size(varargin)); 0038 for ii = 1:nargin,in_names{ii} = inputname(ii);end 0039 0040 % Collect all AOs and plists 0041 [as, ao_invars] = utils.helper.collect_objects(varargin(:), 'ao', in_names); 0042 pl = utils.helper.collect_objects(varargin(:), 'plist', in_names); 0043 0044 % Decide on a deep copy or a modify 0045 bs = copy(as, nargout); 0046 0047 % combine plists 0048 pl = combine(pl, getDefaultPlist()); 0049 0050 %% Extract parameters from plist 0051 0052 % Get parameters out 0053 w = find(pl, 'Omega2'); 0054 0055 % Process each input AO 0056 for j=1:length(bs) 0057 %-------- build time-domain filter 0058 % need a zero at the stiffness frequency 0059 % - take the absolute value of omega 0060 z1 = pz(sqrt(abs(w))/2/pi); 0061 % add a stabilising pole up near the Nyquist 0062 p1 = pz(0.7*bs(j).data.fs/2); 0063 % build pzmodel 0064 pzm = pzmodel(sqrt(abs(w)), p1, z1); 0065 % build filter 0066 ft = miir(pzm, plist('fs', bs(j).data.fs)); 0067 % filter data forwards and backwards to get f^2 response 0068 bs(j).filtfilt(ft); 0069 % Add history 0070 bs(j).addHistory(getInfo, pl, ao_invars(j), bs(j).hist); 0071 % Set AO name 0072 bs(j).setName(sprintf('%s(%s)', mfilename, ao_invars{j}), 'internal'); 0073 end 0074 0075 % Set output 0076 if nargout > 0 0077 varargout{1} = bs; 0078 end 0079 end 0080 0081 %-------------------------------------------------------------------------- 0082 % Get Info Object 0083 %-------------------------------------------------------------------------- 0084 function ii = getInfo(varargin) 0085 if nargin == 1 && strcmpi(varargin{1}, 'None') 0086 sets = {}; 0087 pl = []; 0088 else 0089 sets = {'Default'}; 0090 pl = getDefaultPlist; 0091 end 0092 % Build info object 0093 ii = minfo(mfilename, 'ao', '', utils.const.categories.mdc01, '$Id: mdc1_x2acc.m,v 1.7 2008/09/05 11:05:29 ingo Exp $', sets, pl); 0094 end 0095 0096 %-------------------------------------------------------------------------- 0097 % Get Default Plist 0098 %-------------------------------------------------------------------------- 0099 function pl_default = getDefaultPlist() 0100 pl_default = plist('Omega2', 1.3e-6); 0101 end 0102