You can define a function handle without using the @
symbol in MATLAB as follows:
main.m49 chars4 lines
Here, we define a function myfun
that takes a variable x
and returns its squared value, minus 5.
You can then use this function handle in the same way as before:
main.m33 chars4 lines
Note that you need to save this function definition in a separate file with the same name as the function (myfun.m
in this case) in order to use it in the MATLAB environment.
gistlibby LogSnag