Download presentation
Presentation is loading. Please wait.
Published byWidya Gunawan Modified over 5 years ago
1
Function Handles UC Berkeley Fall 2004, E Copyright 2005, Andy Packard. This work is licensed under the Creative Commons Attribution-ShareAlike License. To view a copy of this license, visit or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
2
Function handles and feval
Several Matlab functions solve your problem by repeatedly calling functions that you supply finding zeros of a function (fzero) Integrating a function (trapz, quad) Integrating a differential equation (ode45) minimizing a function (fminbnd, fminsearch) For example, in calling fzero, you must pass a reference-to-the-function (called a function handle) that you want fzero to find the zeros of. Use operator to get the reference. >> shan >> class(shan) >> feval(shan,linspace(0,pi,5)) New data type: add to list with double, cell, char, struct. Any function (built-in, mfile, etc)
3
Function handles and feval
General syntax for feval is [out1,out2,…] = feval(FuncH,arg1,arg2,…) function handle Output argument list Input argument list
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.