Home > wafo > trgauss > private > writecov.m

writecov

PURPOSE ^

Calculates spline coefficients for the covariance and

SYNOPSIS ^

writecov(cov,nr)

DESCRIPTION ^

  WRITECOV Calculates spline coefficients for the covariance and 
           its derivatives  r_X^(i)(t), i = 0,1,2,3,4.
           The results are saved on ascii files  Cd*.in,
           and are used by  minmax, wave_t  and  wave_th.
 
   CALL: writecov(cov);
         writecov(cov,nr);
  
         cov  = [T,r,r1,r2,...], as returned from  spec2cov.
         nr   = number of derivatives to write
                (default=all=size(cov,2)-2).

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function writecov(cov,nr)
002 % WRITECOV Calculates spline coefficients for the covariance and 
003 %          its derivatives  r_X^(i)(t), i = 0,1,2,3,4.
004 %          The results are saved on ascii files  Cd*.in,
005 %          and are used by  minmax, wave_t  and  wave_th.
006 %
007 %  CALL: writecov(cov);
008 %        writecov(cov,nr);
009 % 
010 %        cov  = [T,r,r1,r2,...], as returned from  spec2cov.
011 %        nr   = number of derivatives to write
012 %               (default=all=size(cov,2)-2).
013 
014 if nargin<2
015   nr=size(cov,2)-2;
016 end
017 
018 if size(cov,2)<2+nr
019   error(['You must supply at least nr=', int2str(nr), ' derivatives.'])
020 end
021 
022 for k=0:nr
023   filename=['Cd', int2str(k), '.in'];
024   if exist(filename)
025     delete(filename)
026   end
027 end
028 
029 n=size(cov,1);
030 for k=0:nr
031   filename=['Cd', int2str(k), '.in'];
032   covar=[cov(:,1), cov(:,k+2), zeros(n,3)];
033   fid=fopen(filename,'wt');
034   fprintf(fid,'%12.10f %12.10E %4.2f %4.2f %4.2f\n',covar');
035   fclose(fid);
036 end
037

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