Home > wafo > onedim > ecross.m

ecross

PURPOSE ^

Extracts exact level v crossings

SYNOPSIS ^

t0 = ecross(t,f,ind,v)

DESCRIPTION ^

 ECROSS Extracts exact level v crossings 
  
   CALL t0 = ecross(t,f,ind,v);
 
   t0  = vector of  exact level v crossings.
   t,f = vectors of arguments and functions values, respectively.
   ind = indices to level v crossings as found by findcross.
   v   = scalar or vector (of size(ind)) defining the level(s) to cross.
 
  ECROSS interpolates t and f linearly to find the exact level v
  crossings, i.e., the points where f(t0) = v
 
  Example
   t = linspace(0,7*pi,250); x = sin(t);
   ind = findcross(x,0.75)  
   t0 = ecross(t,x,ind,0.75);
   plot(t,x,'.',t(ind),x(ind),'r.',...
   t, ones(size(t))*.75, t0,ones(size(t0))*0.75,'g.')
 
  See also  findcross

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

001 function t0 = ecross(t,f,ind,v)
002 %ECROSS Extracts exact level v crossings 
003 % 
004 %  CALL t0 = ecross(t,f,ind,v);
005 %
006 %  t0  = vector of  exact level v crossings.
007 %  t,f = vectors of arguments and functions values, respectively.
008 %  ind = indices to level v crossings as found by findcross.
009 %  v   = scalar or vector (of size(ind)) defining the level(s) to cross.
010 %
011 % ECROSS interpolates t and f linearly to find the exact level v
012 % crossings, i.e., the points where f(t0) = v
013 %
014 % Example
015 %  t = linspace(0,7*pi,250); x = sin(t);
016 %  ind = findcross(x,0.75)  
017 %  t0 = ecross(t,x,ind,0.75);
018 %  plot(t,x,'.',t(ind),x(ind),'r.',...
019 %  t, ones(size(t))*.75, t0,ones(size(t0))*0.75,'g.')
020 %
021 % See also  findcross
022 
023 % Tested on: Matlab 6.0
024 % revised pab Feb2004  
025 % By pab 18.06.2001
026   
027 error(nargchk(4,4,nargin))
028 
029 t0 = t(ind)+(v-f(ind)).*(t(ind+1)-t(ind))./(f(ind+1)-f(ind));
030 return
031 
032

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