% SPECWIN spectral window object class constructor. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: SPECWIN spectral window object class constructor. Create a spectral window from libSpecWin. SUPER CLASSES: ltpda_nuo < ltpda_obj PROPERTIES: Inherit Properties (read only) version - cvs-version string. Protected Properties (read only) type - name of window object alpha - alpha parameter for various window functions psll - peak sidelobe level rov - recommended overlap nenbw - normalised equivalent noise bandwidth w3db - 3 dB bandwidth in bins flatness - window flatness ws - sum of window values ws2 - sum of squares of window values win - window samples (column vector) CONSTRUCTOR: w = specwin() creates an empty object w = specwin(w) copies a specwin object w = specwin('name', N) creates a specwin object of a particular type and length. (see below for supported types.) w = specwin('Kaiser', N, psll) create a specwin Kaiser window with the prescribed psll. 'name' should be one of the following standard windows: Rectangular, Welch, Bartlett, Hanning, Hamming, Nuttall3, Nuttall4, Nuttall3a, Nuttall3b, Nuttall4a Nuttall4b, Nuttall4c, BH92, SFT3F, SFT3M, FTNI, SFT4F, SFT5F SFT4M, FTHP, HFT70, FTSRS, SFT5M, HFT90D, HFT95, HFT116D HFT144D, HFT169D, HFT196D, HFT223D, HFT248D M-FILE INFO: The following call returns an minfo object that contains information about the specwin constructor: >> info = specwin.getInfo or >> info = specwin.getInfo('specwin') You can get information about class methods by calling: >> info = specwin.getInfo(method) e.g. >> info = specwin.getInfo('eq') You can also restrict the sets of parameters contained in the minfo object by calling: >> info = specwin.getInfo(method, set) e.g. >> info = specwin.getInfo('specwin', 'Default') VERSION: $Id: specwin.m,v 1.53 2008/09/03 16:39:05 hewitson Exp $ HISTORY: 30-01-07 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 % % SPECWIN spectral window object class constructor. 0002 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0003 % 0004 % DESCRIPTION: SPECWIN spectral window object class constructor. 0005 % Create a spectral window from libSpecWin. 0006 % 0007 % SUPER CLASSES: ltpda_nuo < ltpda_obj 0008 % 0009 % PROPERTIES: 0010 % 0011 % Inherit Properties (read only) 0012 % version - cvs-version string. 0013 % 0014 % Protected Properties (read only) 0015 % type - name of window object 0016 % alpha - alpha parameter for various window functions 0017 % psll - peak sidelobe level 0018 % rov - recommended overlap 0019 % nenbw - normalised equivalent noise bandwidth 0020 % w3db - 3 dB bandwidth in bins 0021 % flatness - window flatness 0022 % ws - sum of window values 0023 % ws2 - sum of squares of window values 0024 % win - window samples (column vector) 0025 % 0026 % CONSTRUCTOR: 0027 % 0028 % w = specwin() 0029 % creates an empty object 0030 % 0031 % w = specwin(w) 0032 % copies a specwin object 0033 % 0034 % w = specwin('name', N) 0035 % creates a specwin object of a particular type and length. 0036 % (see below for supported types.) 0037 % 0038 % w = specwin('Kaiser', N, psll) 0039 % create a specwin Kaiser window with the prescribed psll. 0040 % 0041 % 'name' should be one of the following standard windows: 0042 % 0043 % Rectangular, Welch, Bartlett, Hanning, Hamming, 0044 % Nuttall3, Nuttall4, Nuttall3a, Nuttall3b, Nuttall4a 0045 % Nuttall4b, Nuttall4c, BH92, SFT3F, SFT3M, FTNI, SFT4F, SFT5F 0046 % SFT4M, FTHP, HFT70, FTSRS, SFT5M, HFT90D, HFT95, HFT116D 0047 % HFT144D, HFT169D, HFT196D, HFT223D, HFT248D 0048 % 0049 % M-FILE INFO: The following call returns an minfo object that contains 0050 % information about the specwin constructor: 0051 % >> info = specwin.getInfo 0052 % or >> info = specwin.getInfo('specwin') 0053 % 0054 % You can get information about class methods by calling: 0055 % >> info = specwin.getInfo(method) 0056 % e.g. >> info = specwin.getInfo('eq') 0057 % 0058 % You can also restrict the sets of parameters contained in 0059 % the minfo object by calling: 0060 % >> info = specwin.getInfo(method, set) 0061 % e.g. >> info = specwin.getInfo('specwin', 'Default') 0062 % 0063 % VERSION: $Id: specwin.m,v 1.53 2008/09/03 16:39:05 hewitson Exp $ 0064 % 0065 % HISTORY: 30-01-07 M Hewitson 0066 % Creation 0067 % 0068 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0069 0070 % w = specwin('Flattop', N, psll) - create a specwin Flattop window 0071 % with the prescribed psll. 0072 0073 classdef specwin < ltpda_nuo 0074 0075 %------------------------------------------------ 0076 %---------- Private read-only Properties -------- 0077 %------------------------------------------------ 0078 properties (SetAccess = private) 0079 type = ''; 0080 alpha = []; 0081 psll = []; 0082 rov = []; 0083 nenbw = []; 0084 w3db = []; 0085 flatness = []; 0086 ws = []; 0087 ws2 = []; 0088 win = []; 0089 end 0090 0091 properties (SetAccess = protected) 0092 version = '$Id: specwin.m,v 1.53 2008/09/03 16:39:05 hewitson Exp $'; 0093 end 0094 0095 %------------------------------------------------ 0096 %-------- Declaration of public methods -------- 0097 %------------------------------------------------ 0098 methods 0099 0100 %------------------------------------------------ 0101 %-------- Property rules -------- 0102 %------------------------------------------------ 0103 0104 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0105 % Constructor % 0106 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0107 function ww = specwin(varargin) 0108 0109 import utils.const.* 0110 utils.helper.msg(msg.OMNAME, 'running %s/%s', mfilename('class'), mfilename); 0111 0112 %%% Call superclass 0113 ww = ww@ltpda_nuo(varargin{:}); 0114 0115 %%%%%%%%%% Set dafault values %%%%%%%%%% 0116 0117 switch nargin 0118 case 0 0119 utils.helper.msg(msg.OPROC1, 'empty constructor'); 0120 case 1 0121 if isa(varargin{1}, 'specwin') 0122 utils.helper.msg(msg.OPROC1, 'copy constructor'); 0123 %%%%%%%%%% spw = specwin(specwin-object) %%%%%%%%%% 0124 % copy existing specwin 0125 ww = copy(varargin{1}, 1); 0126 elseif isstruct(varargin{1}) 0127 utils.helper.msg(msg.OPROC1, 'constructing from struct'); 0128 %%%%%%%%%% spw = specwin(struct) %%%%%%%%%% 0129 0130 %%% Set properties which are declared in this class 0131 spw_struct = varargin{1}; 0132 0133 ww.type = spw_struct.type; 0134 ww.alpha = spw_struct.alpha; 0135 ww.psll = spw_struct.psll; 0136 ww.rov = spw_struct.rov; 0137 ww.nenbw = spw_struct.nenbw; 0138 ww.w3db = spw_struct.w3db; 0139 ww.flatness = spw_struct.flatness; 0140 ww.ws = spw_struct.ws; 0141 ww.ws2 = spw_struct.ws2; 0142 ww.win = spw_struct.win; 0143 ww.version = spw_struct.version; 0144 0145 elseif ischar(varargin{1}) 0146 utils.helper.msg(msg.OPROC1, 'constructing from string'); 0147 error('### Code up the char constructor.'); 0148 end 0149 case 2 0150 utils.helper.msg(msg.OPROC1, 'constructing type %s', varargin{1}); 0151 if ischar(varargin{1}) 0152 %%%%%%%%%% spw = specwin('Win_type', N) %%%%%%%%%% 0153 ww = get_window(ww, varargin{1}, varargin{2}); 0154 else 0155 error('### Unknown 2 argument constructor for specwin object.') 0156 end 0157 case 3 0158 utils.helper.msg(msg.OPROC1, 'constructing type %s', varargin{1}); 0159 %%%%%%%%%% spw = specwin('Kaiser', N, psll) %%%%%%%%%% 0160 ww = get_window(ww, varargin{1}, varargin{2}, varargin{3}); 0161 otherwise 0162 error('### Unknown number of constructor arguments'); 0163 end % End of constructor 0164 0165 end 0166 0167 varargout = copy(varargin) 0168 0169 end % End public methods 0170 0171 0172 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0173 % Methods (Static, Public) % 0174 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0175 0176 methods (Static = true) 0177 0178 varargout = update_struct(varargin); 0179 0180 function ww = getTypes() 0181 ww = {... 0182 'Rectangular', 'Welch', 'Bartlett', 'Hanning', 'Hamming',... 0183 'Nuttall3', 'Nuttall4', 'Nuttall3a', 'Nuttall3b', 'Nuttall4a',... 0184 'Nuttall4b', 'Nuttall4c', 'BH92', 'SFT3F', 'SFT3M', 'FTNI', 'SFT4F', 'SFT5F',... 0185 'SFT4M', 'FTHP', 'HFT70', 'FTSRS', 'SFT5M', 'HFT90D', 'HFT95', 'HFT116D',... 0186 'HFT144D', 'HFT169D', 'HFT196D', 'HFT223D', 'HFT248D'... 0187 }; 0188 end 0189 0190 function out = VEROUT() 0191 out = '$Id: specwin.m,v 1.53 2008/09/03 16:39:05 hewitson Exp $'; 0192 end 0193 0194 function ii = getInfo(varargin) 0195 ii = utils.helper.generic_getInfo(varargin{:}, 'specwin'); 0196 end 0197 0198 function out = SETS() 0199 out = {'Default'}; 0200 end 0201 0202 function out = getDefaultPlist(set) 0203 switch set 0204 case 'Default' 0205 out = plist(); 0206 otherwise 0207 out = plist(); 0208 end 0209 end 0210 0211 end % End static methods 0212 0213 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0214 % Methods (Static, Private) % 0215 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0216 0217 methods (Static = true, Access = private) 0218 0219 varargout = kaiser_alpha(varargin) 0220 varargout = kaiser_flatness(varargin) 0221 varargout = kaiser_nenbw(varargin) 0222 varargout = kaiser_rov(varargin) 0223 varargout = kaiser_w3db(varargin) 0224 0225 end % End static private methods 0226 0227 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0228 % Methods (protected) % 0229 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0230 0231 methods (Access = protected) 0232 varargout = get_window(varargin) 0233 varargout = win_BH92(varargin) 0234 varargout = win_Bartlett(varargin) 0235 varargout = win_FTHP(varargin) 0236 varargout = win_FTNI(varargin) 0237 varargout = win_FTSRS(varargin) 0238 varargout = win_HFT116D(varargin) 0239 varargout = win_HFT144D(varargin) 0240 varargout = win_HFT169D(varargin) 0241 varargout = win_HFT196D(varargin) 0242 varargout = win_HFT223D(varargin) 0243 varargout = win_HFT248D(varargin) 0244 varargout = win_HFT70(varargin) 0245 varargout = win_HFT90D(varargin) 0246 varargout = win_HFT95(varargin) 0247 varargout = win_Hamming(varargin) 0248 varargout = win_Hanning(varargin) 0249 varargout = win_Nuttall3(varargin) 0250 varargout = win_Nuttall3a(varargin) 0251 varargout = win_Nuttall3b(varargin) 0252 varargout = win_Nuttall4(varargin) 0253 varargout = win_Nuttall4a(varargin) 0254 varargout = win_Nuttall4b(varargin) 0255 varargout = win_Nuttall4c(varargin) 0256 varargout = win_Rectangular(varargin) 0257 varargout = win_SFT3F(varargin) 0258 varargout = win_SFT3M(varargin) 0259 varargout = win_SFT4F(varargin) 0260 varargout = win_SFT4M(varargin) 0261 varargout = win_SFT5F(varargin) 0262 varargout = win_SFT5M(varargin) 0263 varargout = win_Welch(varargin) 0264 end 0265 0266 end % End classdef 0267 0268 0269 0270