(Not recommended) Construct inline object
inline is not recommended. Use Anonymous Functions instead.
f = inline(
constructs an inline function object from the MATLAB® expression contained in
expr. The input argument to the
inline function is automatically determined by searching
expr for an
isolated lower case alphabetic character, other than
j, that is not part of a word formed from several alphabetic
characters. If no such character exists,
x is used. If the character is
not unique, the one closest to
x is used. If two characters are found,
the one later in the alphabet is chosen.
Two Independent Variables
This call to
inline defines the function
f to be
dependent on two variables,
f = inline('sin(alpha*x)')
f = Inline function: f(alpha,x) = sin(alpha*x)
inline does not return the desired function variables or if the
function variables are in the wrong order, you can specify the desired variables explicitly
inline argument list.
g = inline('sin(alpha*x)','x','alpha')
g = Inline function: g(x,alpha) = sin(alpha*x)
expr — Function expression
Function expression, specified as a character vector.
arg1,arg2,…,argN — Argument list
list of character vectors
Argument list, specified as a comma-separated list of character vectors.
N — Number of arguments
non-negative integer scalar
Number of arguments other than
x, specified as a non-negative
Three commands related to
inlineallow you to examine an inline function object and determine how it was created.
char(fun)converts the inline function into a character array. This is identical to
fun) returns the names of the input arguments of the inline object
funas a cell array of character vectors.
fun) returns the formula for the inline object
A fourth command
fun) inserts a
/' in the formula for
fun. The result is a vectorized version of the inline function.
Introduced before R2006a