Home > wafo > trgauss > trplot.m

# trplot

## PURPOSE

Plots transformation, g, eg. estimated with dat2tr.

## SYNOPSIS

h=trplot(g,g2,ma,sa)

## DESCRIPTION

``` 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

## CROSS-REFERENCE INFORMATION

This function calls:
 trunmak Split a transformation object into its pieces. class Create object or return object class. error Display message and abort function. hold Hold current graph. ishold Return hold state. mean Average or mean value. plot Linear plot. stairs Stairstep plot. title Graph title. xlabel X-axis label. ylabel Y-axis label.
This function is called by:
 cdf2tr Estimate transformation, g, from observed CDF. Chapter2 % CHAPTER2 Modelling random loads and stochastic waves lc2tr Estimate transformation, g, from observed crossing intensity. lc2tr2 Estimate transformation, g, from observed crossing intensity, version2. recfig5 Transfer function, g, versus the crossing level u

## SOURCE CODE

```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 %
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
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```

Mathematical Statistics
Centre for Mathematical Sciences
Lund University with Lund Institute of Technology

Comments or corrections to the WAFO group

Generated on Thu 06-Oct-2005 02:21:16 for WAFO by m2html © 2003