Programmer Guide/Command Reference/EVAL/ticks2f1: Difference between revisions

From STX Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(5 intermediate revisions by 2 users not shown)
Line 2: Line 2:
Extracts the ''rps'' (= the number of '''r'''otations '''p'''er '''s'''econd) value or track from the tick-signal <var>x</var>.
Extracts the ''rps'' (= the number of '''r'''otations '''p'''er '''s'''econd) value or track from the tick-signal <var>x</var>.
----
----
;Usage:<code>ticks2f1(<var>x</var>, <var>sr, <var>o</var> {, <var>l</var>, <var>s</var>})</code>
;Usage 1:<code>ticks2f1(<var>x</var>, <var>sr</var>, <var>o</var>)</code>
:;<var>x</var>:the tick signal vector
:;<var>x</var>:the tick signal vector
:;<var>sr</var>:sampling rate of the tick signal in Hz
:;<var>sr</var>:sampling rate of the tick signal in Hz; must be >0
:;<var>type</var>:the order of the tick signal
:;<var>o</var>:the order of the tick signal; must be an integer >0
;Description: The function counts the periods of the tick signal and computes the ''rps'' value according to the sampling rate ''sr'' and the order of the tick signal ''o''. The tick signal ''x'' must be a periodic signal (sine wave, triangle, rectangle, sawtooth or pulse) with <var>o</var> periods per rotation.
;Description 1: The function counts the periods of the tick signal and computes the ''rps'' value according to the sampling rate ''sr'' and the order of the tick signal ''o''. The tick signal ''x'' must be a periodic signal (sine wave, triangle, rectangle, sawtooth or pulse) with ''o'' periods per rotation.
::<code>''rps'' = ''sr'' / ''o'' * ''np'' / (''ilast''-''ifirst'')</code>
::<code>''rps'' = ''sr'' / ''o'' * ''np'' / (''ilast''-''ifirst'')</code>
::with:
::with:
Line 16: Line 16:
|''ilast'' ||= || sample index of the end of the last periode
|''ilast'' ||= || sample index of the end of the last periode
|}
|}
;Result 1: The number of periods per second ''rps'' (scalar)
----
;Usage 2:<code>ticks2f1(<var>x</var>, <var>sr</var>, <var>o</var> , <var>len</var>, <var>hop</var>)</code>
:;<var>x, sr, o</var>:see '''Usage 1'''
:;<var>len</var>:the frame length in samples; 2 &le; ''len'' &le; <code>nrow(''x'')/2</code>
:;<var>hop</var>:the distance between frames in samples; 0 < ''hop'' &le; ''len''
;Description 2: The tick signal is parted into frames with a length of ''len'' samples and a distance of ''hop'' samples. For each frame the ''rps'' value is computed as described above.
;Result 2: A vector containing the ''rps'' values of the frames of the tick signal ''x''.
;See also: [[../asp2osp|asp2osp]], [[../sig2osp|sig2osp]], [[../otrack1|otrack1]]


 
[[../#Functions|<function list>]]
smoothed value ''xs''[i] is computed from the data values ''x''[i-m] to ''x''[i+m]. The general form of the smoothing function is:
::<math>xs[i] = \frac{ \sum_{j=-m}^m{x[i+j].w[j]} }{ \sum_{j=-m}^m{w[j]} }</math>
:The weighting coefficients ''w''[i] depend on the value of the argument ''type''
::{|class="einrahmen"
!''type'' !! ''w''[j] !!
|-
|'''0''' ||1 ||average
|-
|'''1''' |||<nowiki>1 / (|j|+1)</nowiki> ||''distance'' weighted average
|}
;Result: A vector ''r'' with <code>nrow(''x'')/s</code> elements. The value ''r''[j] is set to the value ''xs''[j*s] of the smoothed data vector.
 
{{DISPLAYTITLE:{{SUBPAGENAME}}}}
=====ticks2f1=====
 
=====Usage:=====
 
<code>ticks2f1(<var>x</var>, <var>sr</var>, <var>xo</var> {, <var>lfrm</var>, <var>sfrm</var>})</code>
 
=====Function:=====
 
Extracts the rpm value/track (rpm = the number of rotations per second) from the tick-signal <var>x</var>.
 
=====Parameters:=====
 
;<var>x</var>
 
:The tick signal.
 
;<var>sr</var>
 
:The sampling rate of <var>x</var>.
 
;<var>xo</var>
 
:The order of the tick signal.
 
;<var>lfrm</var>
 
:The frame length. The default is <code>nrow(x)</code>.
 
;<var>sfrm</var>
 
:The frame shift. The default is the value of <var>lfrm</var>.
 
=====Result:=====
 
The rpm value or track (a number or a vector).
 
=====Notes:=====
 
;See also: [[Programmer_Guide/Command_Reference/EVAL/optmm|optmm]]
 
[[Programmer_Guide/Command_Reference/EVAL#Functions|<function list>]]

Latest revision as of 19:05, 21 April 2011

Extracts the rps (= the number of rotations per second) value or track from the tick-signal x.


Usage 1
ticks2f1(x, sr, o)
x
the tick signal vector
sr
sampling rate of the tick signal in Hz; must be >0
o
the order of the tick signal; must be an integer >0
Description 1
The function counts the periods of the tick signal and computes the rps value according to the sampling rate sr and the order of the tick signal o. The tick signal x must be a periodic signal (sine wave, triangle, rectangle, sawtooth or pulse) with o periods per rotation.
rps = sr / o * np / (ilast-ifirst)
with:
np = number of detected periodes
ifirst = sample index of the begin of the first periode
ilast = sample index of the end of the last periode
Result 1
The number of periods per second rps (scalar)

Usage 2
ticks2f1(x, sr, o , len, hop)
x, sr, o
see Usage 1
len
the frame length in samples; 2 ≤ lennrow(x)/2
hop
the distance between frames in samples; 0 < hoplen
Description 2
The tick signal is parted into frames with a length of len samples and a distance of hop samples. For each frame the rps value is computed as described above.
Result 2
A vector containing the rps values of the frames of the tick signal x.
See also
asp2osp, sig2osp, otrack1

<function list>

Navigation menu

Personal tools