welchscale
PURPOSE 
WELCHSCALE scales the output of welch to be in the required units
SYNOPSIS 
function [yy, info] = welchscale(xx, win, fs, norm, inunits)
DESCRIPTION 
CROSS-REFERENCE INFORMATION 
This function calls:
- fs FS Get the data property 'fs'.
- norm NORM overloads the norm operator for Analysis Objects.
- sqrt SQRT computes the square root of the data in the AO.
- sum SUM computes the sum of the data in the AO.
This function is called by:
- ao AO analysis object class constructor.
SOURCE CODE 
0001
0002
0003
0004
0005
0006 function [yy, info] = welchscale(xx, win, fs, norm, inunits)
0007
0008 nfft = length(win);
0009 S1 = sum(win);
0010 S2 = sum(win.^2);
0011 enbw = fs * S2 / (S1*S1);
0012
0013 if isempty(norm)
0014 norm = 'None';
0015 end
0016 switch norm
0017 case 'ASD'
0018 yy = sqrt(xx);
0019 info.units = inunits ./ unit('Hz^0.5');
0020 case 'PSD'
0021 yy = xx;
0022 info.units = inunits.^2/unit('Hz');
0023 case 'AS'
0024 yy = sqrt(xx * enbw) ;
0025 info.units = inunits;
0026 case 'PS'
0027 yy = xx * enbw;
0028 info.units = inunits.^2;
0029 case 'None'
0030 yy = xx;
0031 info.units = inunits;
0032 otherwise
0033 error('Unknown normalisation');
0034 end
0035
0036 info.nfft = nfft;
0037 info.enbw = enbw;
0038 info.norm = norm;
0039
0040 end
0041
Generated on Mon 08-Sep-2008 13:18:47 by m2html © 2003