Function

Purpose

Apply arbitrary arithmetic expression to scalar or vectorized input signal

Library

Control / Functions & Tables

Description

../../_images/fcn.svg

The Function block applies an arithmetic expression specified in C language syntax to its input. The input may be a scalar or vectorized continuous signal, the output is always a scalar continuous signal. The expression may consist of one or more of the following components:

  • u — the input of the block. If the input is vectorized, u(i) or u[i] represents element i of the vector. To access the first element, enter u(1), u[1], or u alone.

  • Brackets

  • Numeric constants, including pi

  • Arithmetic operators (+ - * / ^)

  • Relational operators (== != > < >= <=)

  • Logical operators (&& || !)

  • Mathematical functions — abs, acos, asin, atan, atan2, cos, cosh, exp, log, log10, max, min, mod, pow, sgn, sin, sinh, sqrt, tan, and tanh.

  • Workspace variables

Parameters

Expression

The expression applied to the input signal, in C language syntax.

Probe Signals

Input

The input signal.

Output

The output signal.