CMATCOMBINE Combines two cycle matrices. CALL: F = cmatcombine(F1,F2,rangeLim); [F,Lim,FF1,FF2] = cmatcombine(F1,F2,Lim); F1 = Cycle matrix 1 [n,n] F2 = Cycle matrix 2 [n,n] rangeLim = Use F1 for ranges >= rangeLim. [1,1] Lim = Limitations on where to use F1. [struct array] .range = Use F1 for ranges >= Lim.range [1,1] .min = Use F1 for min <= Lim.min [1,1] .max = Use F1 for max >= Lim.max [1,1] F = Cycle matrix, combination of F1 and F2 [n,n] FF1 = Cycle matrix 1, used part [n,n] FF2 = Cycle matrix 2, used part [n,n] Combine the two cycle matrices, F1 and F2, into one matrix, F, according to the conditions given by rangeLim (or Lim). Example: F1 = triu(ones(8),0) F2 = 2*F1 [F,Lim,FF1,FF2]=cmatcombine(F1,F2,2) Lim=[]; Lim.range=2; Lim.min=4; Lim.max=4; [F,Lim,FF1,FF2]=cmatcombine(F1,F2,Lim) See also cmatplot, cc2cmat
Display message and abort function. | |
True if field is in structure array. | |
True for numeric arrays. | |
X and Y arrays for 3-D plots. |
Extrapolates a rainflow matrix. | |
Quick test of the routines in module 'cycles' |
001 function [F,Lim,FF1,FF2] = cmatcombine(F1,F2,in3) 002 003 %CMATCOMBINE Combines two cycle matrices. 004 % 005 % CALL: F = cmatcombine(F1,F2,rangeLim); 006 % [F,Lim,FF1,FF2] = cmatcombine(F1,F2,Lim); 007 % 008 % F1 = Cycle matrix 1 [n,n] 009 % F2 = Cycle matrix 2 [n,n] 010 % rangeLim = Use F1 for ranges >= rangeLim. [1,1] 011 % Lim = Limitations on where to use F1. [struct array] 012 % .range = Use F1 for ranges >= Lim.range [1,1] 013 % .min = Use F1 for min <= Lim.min [1,1] 014 % .max = Use F1 for max >= Lim.max [1,1] 015 % 016 % F = Cycle matrix, combination of F1 and F2 [n,n] 017 % FF1 = Cycle matrix 1, used part [n,n] 018 % FF2 = Cycle matrix 2, used part [n,n] 019 % 020 % Combine the two cycle matrices, F1 and F2, into one matrix, F, 021 % according to the conditions given by rangeLim (or Lim). 022 % 023 % Example: 024 % F1 = triu(ones(8),0) 025 % F2 = 2*F1 026 % [F,Lim,FF1,FF2]=cmatcombine(F1,F2,2) 027 % Lim=[]; Lim.range=2; Lim.min=4; Lim.max=4; 028 % [F,Lim,FF1,FF2]=cmatcombine(F1,F2,Lim) 029 % 030 % See also cmatplot, cc2cmat 031 032 % Tested on Matlab 5.3 033 % 034 % History: 035 % Created by PJ (Pär Johannesson) 24-Jul-2000 036 % Updated by PJ 29-Aug-2000 037 038 % Check input arguments 039 ni = nargin; 040 no = nargout; 041 error(nargchk(3,3,ni)); 042 043 % Third argument - Limitation 044 if isnumeric(in3) 045 Lim.range = in3; 046 else 047 Lim = in3; 048 end 049 050 n=length(F1); % Size of matrices 051 052 % Treat Lim 053 if ~isfield(Lim,'range'), Lim.range = []; end 054 if ~isfield(Lim,'min'), Lim.min = []; end 055 if ~isfield(Lim,'max'), Lim.max = []; end 056 057 % Default values 058 if isempty(Lim.range), Lim.range = 0; end 059 if isempty(Lim.min), Lim.min = n; end 060 if isempty(Lim.max), Lim.max = 1; end 061 062 063 % Combine the rainflow matrices 064 065 J=meshgrid(1:n); % Columns = maximum 066 I=J'; % Rows = minimum 067 K1 = (J-I>=Lim.range) &(I<=Lim.min) & (J>=Lim.max); % Where to use F1? 068 FF1 = F1; FF1(~K1)=0; % Set FF1 to zero where F1 shall NOT be used 069 FF2 = F2; FF2(K1) =0; % Set FF2 to zero where F1 shall be used 070 F = FF1+FF2; % Combination 071 072 % Old code 073 % Combine the rainflow matrices 074 075 %F=F2; 076 %for i = 1:n 077 % for j = i:n 078 % if (j-i>=Lim.range) &(i<=Lim.min) & (j>=Lim.max) 079 % F(i,j) = F1(i,j); 080 % end 081 % end 082 %end 083
Comments or corrections to the WAFO group