TRPLOT Plots transformation, g, eg. estimated with dat2tr. CALL: trplot(g,g2,ma,sa) g,g2 = smoothed and empirical estimate of the transformation g, ma,sa = mean and standard deviation, respectively, of the observed function. Default ma = mean(g(:,1)) sa = (abs(g(1,1)-ma)+abs(g(end,1)-ma))/10 See also dat2tr, lc2tr, mctrtest
Split a transformation object into its pieces. | |
Create object or return object class. | |
Display message and abort function. | |
Hold current graph. | |
Return hold state. | |
Average or mean value. | |
Linear plot. | |
Stairstep plot. | |
Graph title. | |
X-axis label. | |
Y-axis label. |
Estimate transformation, g, from observed CDF. | |
% CHAPTER2 Modelling random loads and stochastic waves | |
Estimate transformation, g, from observed crossing intensity. | |
Estimate transformation, g, from observed crossing intensity, version2. | |
Transfer function, g, versus the crossing level u |
001 function h=trplot(g,g2,ma,sa) 002 %TRPLOT Plots transformation, g, eg. estimated with dat2tr. 003 % 004 % CALL: trplot(g,g2,ma,sa) 005 % 006 % g,g2 = smoothed and empirical estimate of the transformation g, 007 % ma,sa = mean and standard deviation, respectively, of the observed 008 % function. 009 % Default ma = mean(g(:,1)) 010 % sa = (abs(g(1,1)-ma)+abs(g(end,1)-ma))/10 011 % 012 % See also dat2tr, lc2tr, mctrtest 013 014 % Tested on: Matlab 6.0, 5.3, 5.2, 5.1 015 % 016 % History: 017 % revised pab Feb2004 018 % revised jr 03.04.2001 019 % - fixed a bug regarding nargin 020 % - updated information 021 % revised pab 04.01.2001 022 % - added the possibility that g is a transformation object 023 % revised pab 01.01.2001 024 % - added ih 025 % modified by svi 29.09.99 026 % g and g2 are compared with the linear transformation based on (ma,sa). 027 % Obs. estimates of the transformation are not normalized. 028 % by pab 11.11.98 029 % 030 031 error(nargchk(1,4,nargin)) 032 switch class(g) 033 case 'double', 034 if nargin<3|isempty(ma), ma=mean(g(:,1)); end 035 if nargin<4|isempty(sa), sa=(abs(g(1,1)-ma)+abs(g(end,1)-ma))/10;end 036 case 'struct' , % transformation object. 037 tr = g; 038 [g,ma,sa, form] = trunmak(tr); % split object 039 switch form 040 case 'pp', error('Not implemented for ''pp'' form yet.') 041 case 'table', 042 if isempty(ma), ma=mean(g(:,1)); end 043 if isempty(sa), sa=(abs(g(1,1)-ma)+abs(g(end,1)-ma))/10;end 044 end 045 end 046 047 color='rgbwkymc'; 048 uu=(g(:,1)-ma)/sa; 049 ih = ishold; 050 if ih, ix=3;else ix=1;end 051 052 hh = plot(g(:,1),g(:,2),color(ix),g(:,1),uu,'g--'); 053 054 if nargin>1&~isempty(g2) 055 hold on 056 stairs(g2(:,1),g2(:,2)) 057 if ~ih, hold off, end 058 end 059 060 %axis([uu(1) uu(end) uu(1) uu(end)]) 061 %axis square 062 063 064 065 title('Estimated transform') 066 ylabel('g(u)') 067 xlabel('u') 068 069 if nargout==1, h=hh;end 070 071
Comments or corrections to the WAFO group