Introduction
Function handles let you store and use functions like variables. This helps you call functions later or pass them around easily.
f = @functionName; % or for anonymous functions: f = @(input) expression;
f = @sin;
result = f(pi/2);square = @(x) x.^2; result = square(4);
f = @max; result = f([1, 5, 3]);
square = @(x) x.^2; nums = [1, 2, 3, 4]; squares = arrayfun(square, nums); disp(squares);
sin in MATLAB?f = @(x) x^2 + 3; result = f(2);
g = @(x) x + 1; h = @g(2);
Pass the test and this pattern moves unknown