Actual zero or any-value crossing

버전 1.0.0.0 (2.93 KB) 작성자: Christos Saragiotis
Finds actual zero (or any other value) "actual" crossings
다운로드 수: 1.1K
업데이트 날짜: 2007/10/5

라이선스 보기

CROSSINGS returns the crossings of a given value in a vector. Note that it does not return "occurrences" of that value, unless the value is actually crossed.

When there is a value-crossing but not occurrence of that value, the user can determine if they want the crossing to be assigned either
- to the previous element of the input vector (option 'pre'), or
- to the following element (option 'fol'), or
- to that element whose value is closer to the value whose crossings are sought (option 'dis'), or
- to a value calculated after interpolation between the two (preceding and following) elements (option 'int').

Occurrences of the value whose crossings are sought at the beginning or end of the input vector are ignored (since no
actual crossings occur).

Also consecutive occurrences of the value whose crossings are sought, are assigned to the last occurrence before the crossing (see last example).

EXAMPLES
1. Assume that VALUE=0, X(4)=-2 and X(5)=3. Then
- 'dis' will assign the 0-crossing to n=4,
- 'pre' will assign the 0-crossing to n=4,
- 'fol' will assign the 0-crossing to n=5 and
- 'int' will assign the 0-crossing to t=4.4.

2. Assume that the VALUE = 0.
- X = [1 -1 0 -1]: CROSSING will return the 0-crossing from 1 to -1.
- The sequence -1, 0, -1 is not considered a crossing (0 is only reached but not crossed).
- X = [-1 0 0 -1]: CROSSING will not return any 0-crossings (0 is only reached but not crossed).
- X = [1 0 0 -1] : CROSSING will return only one 0-crossing at element 3 (from 0 to -1).

Although the code is checked, please send any overlookings or bugs.

It should work also when using previous versions.

인용 양식

Christos Saragiotis (2024). Actual zero or any-value crossing (https://www.mathworks.com/matlabcentral/fileexchange/16155-actual-zero-or-any-value-crossing), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2007a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Signal Operations에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.0.0.0

The previous version worked only for row vectors. Thanks to the review by John Lintern, it now works for column vectors as well.