SETFREQ sets the frequency vector of a fsdata object based on the length of the y vector and the sample rate. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% DESCRIPTION: SETFREQ sets the frequency vector of a fsdata object based on the length of the y vector and the sample rate. CALL: fsd = setFreq(fsd) VERSION: $Id: setFreq.m,v 1.5 2008/02/12 22:11:21 hewitson Exp $ HISTORY: 31-01-2007 M Hewitson Creation %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
0001 function fsd = setFreq(fsd, varargin) 0002 % SETFREQ sets the frequency vector of a fsdata object based on the length of the y vector and the sample rate. 0003 % 0004 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0005 % 0006 % DESCRIPTION: SETFREQ sets the frequency vector of a fsdata object based on the 0007 % length of the y vector and the sample rate. 0008 % 0009 % CALL: fsd = setFreq(fsd) 0010 % 0011 % VERSION: $Id: setFreq.m,v 1.5 2008/02/12 22:11:21 hewitson Exp $ 0012 % 0013 % HISTORY: 31-01-2007 M Hewitson 0014 % Creation 0015 % 0016 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0017 0018 VERSION = '$Id: setFreq.m,v 1.5 2008/02/12 22:11:21 hewitson Exp $'; 0019 CATEGORY = 'Internal'; 0020 0021 if nargin == 2 && isa(fsd, 'fsdata') && ischar(varargin{1}) 0022 if strcmp(varargin{1}, 'Params') 0023 fsd = plist(); 0024 return 0025 elseif strcmp(varargin{1}, 'Version') 0026 fsd = VERSION; 0027 return 0028 elseif strcmp(varargin{1}, 'Category') 0029 fsd = CATEGORY; 0030 return 0031 end 0032 end 0033 0034 fsd.x = linspace(0, fsd.fs/2, length(fsd.y)); 0035 fsd = reshapeF(fsd); 0036 0037 % END