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
Display message and abort function. |
% CHAPTER3 Demonstrates distributions of wave characteristics | |
Extracts waveheights and steepnesses from data. | |
Extracts sequence of wavelengths from data. |
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
Comments or corrections to the WAFO group