automir

Returns a mirror factor (either 1 or -1) that is value-dependent, either by position of the centroid or the position of the min/max values relative to the x axis.

Syntax

automir(yvec, trigfact, xvec(optional))

Input

yvec
The dependent vector.
trigfact
A factor between 0 and 1.
A value of 0.5 means that if the mean value of the minimum and maximum of the dependent vector is below the x axis, the return value will be -1. If it is above or on the x axis, then the return value will be 1.
A value of 0.3 means that instead of the mean value, this value will be calculated by the formula max-(max-min)*0.3.
xvec(optional)
The independent vector. If this argument is provided, the position of the centroid will be used.

Example

This example illustrates how automirror calculates the mirror factor in a note and uses it in multiple expressions: KTH Injury Risk = {kth(c1.x, automir(c1.y,0.5)*c1.y,1,0)}


Figure 1.

Comments

Sometimes curves (especially injury test curves) are scaled with a factor of -1, which requires user interaction to evaluate the math correctly. This factor can be used in any math expression. automir makes reports more robust so that they incorporate both curves.