| Simulink® | ![]() |
User-Defined Functions
The MATLAB Fcn block applies the specified MATLAB function or expression to the input. The output of the function must match the output dimensions of the block or an error occurs.
Here are some sample valid expressions for this block.
sin atan2(u(1), u(2)) u(1)^u(2)
Note This block is slower than the Fcn block because it calls the MATLAB parser during each integration step. Consider using built-in blocks (such as the Fcn block or the Math Function block) instead, or writing the function as an M-file or MEX-file S-function, then accessing it using the S-Function block. |
The MATLAB Fcn block accepts one complex or real input of type double and generates real or complex output of type double, depending on the setting of the Output signal type parameter.

The function or expression. If you specify a function only, it is not necessary to include the input argument in parentheses.
Dimensions of the signal output by this block. If the output dimensions are to be the same as the dimensions of the input signal, specify -1. Otherwise, enter the dimensions of the output signal, e.g., 2 for a two-element vector. In either case, the output dimensions must match the dimensions of the value returned by the function or expression in the MATLAB function field.
The dialog allows you to select the output signal type of the MATLAB Fcn as real, complex, or auto. A value of auto sets the block's output type to be the same as the type of the input signal.
Outputs a 2-D array as a 1-D array containing the 2-D array's elements in column-major order.
Specify the time interval between samples. To inherit the sample time, set this parameter to -1. See Specifying Sample Time in the online documentation for more information.
Direct Feedthrough | Yes |
Sample Time | Inherited from driving block |
Scalar Expansion | N/A |
Dimensionalized | Yes |
Zero Crossing | No |
![]() | Math Function | Matrix Concatenate, Vector Concatenate | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |