<< CL_intervDiff Math CL_intervInters >>

celestlab >> Math > CL_intervFromCond

CL_intervFromCond

Intervals where a condition is met

Calling Sequence

[interv] = CL_intervFromCond(condition [[, x, margin]])

Description

Parameters

condition:

(boolean) Condition to be met. (1xN)

x:

(optional) Corresponding abscissa. Default is 1:N. (1xN)

margin:

(optional) Relative margin (between -1 and 1). Default value is 0. (1x1)

interv:

Intervals where "condition" is true. (2xP)

Authors

Examples

x = linspace(0, 10, 101);
condition = (cos(x) > 0.2);
// Intervals of x
interv = CL_intervFromCond(condition, x)
// Intervals of indices
interv = CL_intervFromCond(condition)
// Same result as above
interv = CL_intervFromCond(condition, 1 : length(x))
// Intervals of x with +50% margin
interv = CL_intervFromCond(condition, x, margin = 0.5)

Report an issue
<< CL_intervDiff Math CL_intervInters >>