SMOOTHCMAT_HNORM Bandwidth selection for kernel smoothing of a cycle matrix. CALL: h_norm = smoothcmat_hnorm(F); h_norm = smoothcmat_hnorm(F,NOsubzero); Input: F = Cycle matrix. [nxn] NOsubzero=Number of subdiagonals that are zero (Optional, Default = 0, only the diagonal is zero) Output: h_norm = Selected bandwidth. This choice is optimal if the sample is from a normal distribution The normal bandwidth usualy oversmooths, therefore one should choose a slightly smaller bandwidth, e.g. h=0.7*h_norm See also cc2cmat, tp2rfc, tp2mm, dat2tp.
Extrapolates a rainflow matrix. | |
Smooth a cycle matrix using (adaptive) kernel smoothing |
001 function h_norm = smoothcmat_hnorm(F,NOsubzero) 002 003 %SMOOTHCMAT_HNORM Bandwidth selection for kernel smoothing of a cycle matrix. 004 % 005 % CALL: h_norm = smoothcmat_hnorm(F); 006 % h_norm = smoothcmat_hnorm(F,NOsubzero); 007 % 008 % Input: 009 % F = Cycle matrix. [nxn] 010 % NOsubzero=Number of subdiagonals that are zero 011 % (Optional, Default = 0, only the diagonal is zero) 012 % 013 % Output: 014 % h_norm = Selected bandwidth. 015 % 016 % This choice is optimal if the sample is from a normal distribution 017 % The normal bandwidth usualy oversmooths, therefore one should choose 018 % a slightly smaller bandwidth, e.g. h=0.7*h_norm 019 % 020 % See also cc2cmat, tp2rfc, tp2mm, dat2tp. 021 022 % Tested on Matlab 5.3 023 % 024 % History: 025 % Created by PJ (Pär Johannesson) 18-Oct-2000 026 % from 'smoothcmat' 027 028 % Check input arguments 029 030 ni = nargin; 031 no = nargout; 032 error(nargchk(1,2,ni)); 033 034 if ni<2, NOsubzero=[]; end 035 036 if isempty(NOsubzero), NOsubzero=0; end 037 038 n = length(F); % Size of matrix 039 N = sum(sum(F)); % Total number of cycles 040 041 d = 2; % 2-dim 042 [I,J] = meshgrid(1:n,1:n); 043 044 % Choosing bandwidth 045 % This choice is optimal if the sample is from a normal distr. 046 % The normal bandwidth usualy oversmooths, 047 % therefore we choose a slightly smaller bandwidth 048 049 h0 = N^(-1/(d+4)); 050 FF = F+F'; 051 mean_F = sum(sum(FF).*(1:n))/N/2; 052 s2 = sum(sum(FF).*((1:n)-mean_F).^2)/N/2; 053 s = sqrt(s2); % Mean of std in each direction 054 h_norm = s*h0; % Optimal for Normal distr. 055 h = h_norm; % Test 056
Comments or corrections to the WAFO group