LC2RFMEXTREME Compute extreme RFM from level crossings. CALL: Frfc = lc2nt(lc) [Frfc,u,Nrfc,Nrfc0] = lc2nt(lc) lc = Level upcrossing intensity. [nx2] Frfc = Extreme RFM. [nxn] u = Discrete levels. [1xn] Nrfc = Cumulative extreme RFM. [nxn] Nrfc0 = Cumulative extreme RFM, before correction. [nxn] Computes the 'extreme RFM', an approximation of the RFM which is good for large cycles (low minima and high maxima). The approximation is based on the assumtion that level crossings of high and low levels are two independent Poisson processes. This results in a simple expression for the intensity of interval crossings, which is the same as the cumulative RFM. Example: Gaussian process u = (-5:0.2:5)'; lc = [u exp(-u.^2/2)]; [Frfc,u,Nrfc] = lc2rfmextreme(lc); cmatplot(u,u,{Frfc Nrfc},3) See also cmat2extralc, rfmextrapolate, tp2rfc, cc2cmat, dtp2rfm
Calculates a counting distribution from a cycle matrix. | |
Calculates a cycle matrix from a counting distribution. | |
Display message and abort function. | |
X and Y arrays for 3-D plots. | |
Extract upper triangular part. |
Extrapolates a rainflow matrix. | |
Quick test of the routines in module 'cycles' |
001 function [Frfc,u,Nrfc,Nrfc0]=lc2nt(lc,vect) 002 %LC2RFMEXTREME Compute extreme RFM from level crossings. 003 % 004 % CALL: Frfc = lc2nt(lc) 005 % [Frfc,u,Nrfc,Nrfc0] = lc2nt(lc) 006 % 007 % lc = Level upcrossing intensity. [nx2] 008 % 009 % Frfc = Extreme RFM. [nxn] 010 % u = Discrete levels. [1xn] 011 % Nrfc = Cumulative extreme RFM. [nxn] 012 % Nrfc0 = Cumulative extreme RFM, before correction. [nxn] 013 % 014 % Computes the 'extreme RFM', an approximation of the RFM which 015 % is good for large cycles (low minima and high maxima). 016 % The approximation is based on the assumtion that level crossings 017 % of high and low levels are two independent Poisson processes. 018 % This results in a simple expression for the intensity of interval 019 % crossings, which is the same as the cumulative RFM. 020 % 021 % Example: Gaussian process 022 % u = (-5:0.2:5)'; lc = [u exp(-u.^2/2)]; 023 % [Frfc,u,Nrfc] = lc2rfmextreme(lc); 024 % cmatplot(u,u,{Frfc Nrfc},3) 025 % 026 % See also cmat2extralc, rfmextrapolate, tp2rfc, cc2cmat, dtp2rfm 027 028 % References: 029 % 030 % Johannesson, P., and Thomas, J-.J. (2000): 031 % Extrapolation of Rainflow Matrices. 032 % Preprint 2000:82, Mathematical statistics, Chalmers, pp. 18. 033 034 % Tested on Matlab 5.3 035 % 036 % History: 037 % Created by PJ (Pär Johannesson) 14-Feb-2000 038 % Revised by PJ 20-Jul-2000 039 % Revised by PJ 03-Oct-2000 040 % Vectorized some calculations. Now much faster. 041 % vect = 0 : Not vectorized. 042 % 1 : Vectorized. 043 044 % Check input arguments 045 ni = nargin; 046 no = nargout; 047 error(nargchk(1,2,ni)); 048 049 if ni<2, vect = []; end 050 051 % Default values, vectorized calculations 052 if isempty(vect), vect=1; end % Vectorized calculations 053 054 % Treat input data 055 n = size(lc,1); % Number of rows = number of levels 056 u = lc(:,1); % Discrete levels 057 lc = lc(:,2); % intensity of level crossings 058 059 % Compute the cumulative RFM 060 if vect == 0 % Not vectorized calculations 061 062 Nrfc0 = zeros(n,n); 063 for i = 2:n 064 for j = i-1:n-1 065 if (lc(i)+lc(j)) ~= 0 066 Nrfc0(i,j) = lc(i)*lc(j)/(lc(i)+lc(j)); 067 end 068 end 069 end 070 071 else % Vectorized calculations 072 073 [LCi,LCj] = meshgrid(lc,lc); 074 LCi=triu(LCi); 075 LCj=triu(LCj); 076 I = (LCi+LCj~=0); 077 Nrfc0 = zeros(n,n); 078 Nrfc0(I) = LCi(I).*LCj(I)./(LCi(I)+LCj(I)); 079 080 end 081 082 % Convert: Nrfc0 --> Frfc 083 if vect == 0 % Not vectorized calculations 084 085 Frfc = zeros(n,n); 086 for i= 1:n-1 087 for j= i+1:n 088 Frfc(i,j) = Nrfc0(i+1,j-1) - Nrfc0(i,j-1) - Nrfc0(i+1,j) + Nrfc0(i,j); 089 end 090 end 091 092 else % Vectorized calculations 093 094 Frfc=nt2cmat(Nrfc0); 095 Frfc=triu(Frfc,1); 096 097 end 098 099 %keyboard 100 101 % Set negative elements to zero. 102 I = Frfc<0; 103 if any(I(:)) 104 %warning(['Negative elements in calculated rainflow matrix Frfc. Setting to zero!']); 105 Frfc(I) = 0; 106 end 107 108 % Convert: Frfc --> Nrfc 109 Nrfc = cmat2nt(Frfc); % Calculate cumulative RFM (rainflow counting intensity) 110 111 112
Comments or corrections to the WAFO group