Home > wafo > wdemos > itmkurs > load2ud.m

load2ud

PURPOSE ^

Calculates the number of up/downcrossings of a load.

SYNOPSIS ^

[Nup,Ndown,u] = load2ud(param,L)

DESCRIPTION ^

   LOAD2UD Calculates the number of up/downcrossings of a load.
   
   CALL: [Nup,Ndown,u] = udcross([a b n],L);
 
   where
    
         Nup   = the number of upcrossings of level  u_i,
         Ndown = the number of downcrossings of level  u_i,
         u     = a one column matrix with levels  u_i,
         a,b   = limits for  u,  a <= u_i <= b,
         n     = the number of levels  u_i,
         L     = a two column matrix with times in the first column and 
                 load values in the second.
 
   Note that the parameter matrix can be used as input.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function [Nup,Ndown,u] = load2ud(param,L)
002 %  LOAD2UD Calculates the number of up/downcrossings of a load.
003 %  
004 %  CALL: [Nup,Ndown,u] = udcross([a b n],L);
005 %
006 %  where
007 %   
008 %        Nup   = the number of upcrossings of level  u_i,
009 %        Ndown = the number of downcrossings of level  u_i,
010 %        u     = a one column matrix with levels  u_i,
011 %        a,b   = limits for  u,  a <= u_i <= b,
012 %        n     = the number of levels  u_i,
013 %        L     = a two column matrix with times in the first column and 
014 %                load values in the second.
015 %
016 %  Note that the parameter matrix can be used as input.
017 
018 a=param(1); b=param(2); n=param(3);
019 
020 if a>b, disp('   a>b, program will terminate.'), end
021 if n<1,  disp('   n<1, program will terminate.'),  end
022 
023 if n == 1
024   u = a;
025 else
026   u=levels(param);
027 end
028 
029 Nup=zeros(1,n);
030 Ndown=zeros(1,n);
031 
032 N = size(L,1);
033 
034 for i = 1:n
035   index = (L(1:N-1,2)<u(i)) & (L(2:N,2)>u(i));
036   Nup(i) = sum(index);
037 
038   index = (L(1:N-1,2)>u(i)) & (L(2:N,2)<u(i));
039   Ndown(i) = sum(index);
040 end
041

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