edit on the command line, the `MATLAB Editor/Debugger' is opened.
If you now type the lines:
function y = f(x) y = x.^2 + exp(x);and you save the file under the name `f.m', then within MATLAB the function
edit f in the command prompt.
>> f = @(x)(x.^2+exp(x))Here,
@ is the function handle, x is the input argument and x.^2+exp(x) is the function.
Anonymous functions can have multiple input arguments. The general structure of anonymous functions is name = @(input arguments) (functions).
The anonymous function will be evaluated in the same way as the function m-files. Thus the value of
>> f(1.2)
ans =
4.7601
Esteur
2010-03-22