TRMAK Put together a transformation object. CALL: tro = trmak(tr,ma,sa,note); tro = Transformation struct with the fields: tro.form = string identifying the transformation object, 'pp', or 'table'. tro.tr = tr (see tr below) tro.mean = ma tro.std = sa tro.note = memorandum note tro.date = createion date and time. tr = Two column table [x g(x)] or a pp-object giving the transformation. ma,sa = mean and standard deviation of the process. Examples: tro = trmak; % Make an empty transformation object. sa = 2; skew = .20; kurt = (4*skew/3).^2+3; ma =0; tro1 = trmak(hermitetr([],[sa skew,kurt,ma]),ma,sa); See also trunmak
Concatenate arrays. | |
Create object or return object class. | |
String representation of date. | |
Display message and abort function. | |
Get structure field names. | |
True if field is in structure array. | |
Current date and time as date number. | |
Convert string matrix to numeric array. | |
Set unique. | |
MATLAB version number. |
001 function tro = trmak(tr,ma,sa,note) 002 %TRMAK Put together a transformation object. 003 % 004 % CALL: tro = trmak(tr,ma,sa,note); 005 % 006 % tro = Transformation struct with the fields: 007 % tro.form = string identifying the transformation object, 008 % 'pp', or 'table'. 009 % tro.tr = tr (see tr below) 010 % tro.mean = ma 011 % tro.std = sa 012 % tro.note = memorandum note 013 % tro.date = createion date and time. 014 % tr = Two column table [x g(x)] or a pp-object giving the transformation. 015 % ma,sa = mean and standard deviation of the process. 016 % 017 % Examples: 018 % tro = trmak; % Make an empty transformation object. 019 % sa = 2; skew = .20; kurt = (4*skew/3).^2+3; ma =0; 020 % tro1 = trmak(hermitetr([],[sa skew,kurt,ma]),ma,sa); 021 % 022 % See also trunmak 023 024 % Tested on: Matlab 5.3 025 % History: 026 % By pab 02.04.2001 027 028 029 % TODO % This is not complete. Implement this structure in all XXX2tr programs. 030 031 % Legal field names: 032 nam1 = { 'form','tr','mean','std','note','date'}; 033 034 035 if nargin==0, % make an empty object 036 tr =[];ma =[]; sa =[];note =[]; 037 else 038 error(nargchk(3,4,nargin)) 039 if nargin<4, note = []; end 040 switch class(tr), 041 case 'struct', 042 nam = fieldnames(tr); 043 044 nam2 = unique(cat(1,nam(:),nam1(:))); 045 if length(nam2)==length(nam), % tr is already a transformation struct. 046 tro = tr; 047 return 048 elseif isfield(tr,'form') % We are dealing with a PP-object 049 tro.form = tr.form; 050 else 051 error('TR input is not a valid transformation function') 052 end 053 case 'double', 054 mvrs = version; 055 ix = find(mvrs=='.'); 056 mvrs = str2num(mvrs(1:ix(2)-1)); 057 trsz = size(tr); 058 if (tr(1)==10) & prod(trsz)==length(tr) & mvrs<=5.2, 059 tro.form ='pp'; % Old pp-form object. Matlab version 5.2 and below 060 elseif trsz(2)==2, 061 tro.form = 'table'; 062 else 063 error('TR input is not a valid transform function') 064 end 065 end 066 end 067 tro.tr = tr; % Transformation 068 tro.mean = ma; % mean 069 tro.std = sa; % standard deviation 070 tro.note = note; 071 tro.date = datestr(now); 072 073 074 075
Comments or corrections to the WAFO group