inline
(Not recommended) Construct inline object
inline is not recommended. Use Anonymous Functions instead.
Description
f = inline(
constructs an inline function object from the MATLAB® expression contained in expr)expr. The input argument to the
inline function is automatically determined by searching expr for an
isolated lowercase alphabetic character, other than i or
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.
f = inline(
constructs an inline function whose input arguments are specified by
expr,arg1,arg2,…,argN)arg1,arg2,…,argN. Multicharacter symbol names may be used.
Examples
Two Independent Variables
This call to inline defines the function f to be
dependent on two variables, alpha and x:
f = inline('sin(alpha*x)')
f =
Inline function:
f(alpha,x) = sin(alpha*x)If 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
with the inline argument list.
g = inline('sin(alpha*x)','x','alpha')
g =
Inline function:
g(x,alpha) = sin(alpha*x)Input Arguments
Tips
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 toformula(fun).argnames(fun) returns the names of the input arguments of the inline objectfunas a cell array of character vectors.formula(fun) returns the formula for the inline objectfun.A fourth command
vectorize(fun) inserts a.before any^,*, or/in the formula forfun. The result is a vectorized version of the inline function.
Version History
Introduced before R2006a