RMCMAT2CMAT Converts a cycle matrix from Range-Mean format to min-max format. CALL: F = rmcmat2cmat(Frm); [F,param] = rmcmat2cmat(Frm,paramM,paramR); Output: F = Cycle matrix in min-max format. [nxn] param = [a b n] ; defines discretization of levels. Input: Frm = Cycle matrix in range-mean format. [nxn] paramM = [a b n] ; defines discretization of mean-values. paramR = [a b n] ; defines discretization of ranges. NB! Due to different discretizations for Frm and F, the mean values will not be identical. See also cmat2rmcmat
Display message and abort function. | |
Convert number to string. (Fast version) | |
Display warning message; disable or enable warning messages. |
Quick test of the routines in module 'cycles' |
001 function [F,param] = rmcmat2cmat(Frm,paramM,paramR) 002 % RMCMAT2CMAT Converts a cycle matrix from Range-Mean format to min-max format. 003 % 004 % CALL: F = rmcmat2cmat(Frm); 005 % [F,param] = rmcmat2cmat(Frm,paramM,paramR); 006 % Output: 007 % F = Cycle matrix in min-max format. [nxn] 008 % param = [a b n] ; defines discretization of levels. 009 % Input: 010 % Frm = Cycle matrix in range-mean format. [nxn] 011 % paramM = [a b n] ; defines discretization of mean-values. 012 % paramR = [a b n] ; defines discretization of ranges. 013 % 014 % NB! Due to different discretizations for Frm and F, 015 % the mean values will not be identical. 016 % 017 % See also cmat2rmcmat 018 019 % Tested on Matlab 5.3 020 % 021 % History: 022 % Revised by PJ 18-May-2000 023 % Updated help text. 024 % Created by PJ (Pär Johannesson) 12-Apr-2000 025 026 % Check input arguments 027 028 ni = nargin; 029 no = nargout; 030 error(nargchk(1,4,ni)); 031 032 % Initiate matirces 033 n = length(Frm); 034 F = zeros(n,n); 035 036 % Convert 037 038 for r = 1:n 039 for m = 1:n 040 if Frm(r,m) ~= 0 041 i = ceil(m-(r-1)/2); 042 j = ceil(m+(r-1)/2); 043 if i<1 | i>n, 044 warning(['minimum out of range (' num2str(i) '). Setting to boundary of [1,' num2str(n) '].']); 045 i = min(max(i,1),n); 046 end 047 if j<1 | j>n, 048 warning(['Maximum out of range (' num2str(j) '). Setting to boundary [1,' num2str(n) '].']); 049 j = min(max(j,1),n); 050 end 051 F(i,j) = Frm(r,m); 052 end 053 end 054 end 055 056 if ni>1 057 param = paramM; 058 end 059
Comments or corrections to the WAFO group