difference between anonymous function and symbolic function

85 views (last 30 days)
I declared a function in the following two ways. I want to know the difference between two function declarations
1) syms x y(x)
f=x+y
2) f=@(x,y) x+y
May I know the purpose of function handle

Answers (1)

Adithi
Adithi on 14 Jul 2022
Hello,
I understand that you are trying to figure out the difference between anonymous function and symbolic function.
Anonymous function:
An anonymous function is a one-line expression-based MATLAB function that does not require a program file. This is essential for problems that include solving a nonlinear equation, integrating, differentiating function, minimizing a function or a solving differential equation.
Refer to the below documentation for more information on anonymous function. https://in.mathworks.com/help/matlab/matlab_prog/anonymous-functions.html
Symbolic functions:
Symbolic functions represent math functions. The symbolic functions are used for differentiation, integration, solving ODEs. Refer to below documentation for more information on symbolic function.
Purpose of function handle.
A typical purpose of function handle is to pass a function to another function. In anonymous function the function handle is used because it can store not only an expression, but also variables that the expression requires for evaluation.
Hope this helps!.

Categories

Find more on Symbolic Math Toolbox in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!