简体   繁体   中英

passing functions to functions in matlab / octave

I'm looking at passing a function to a function.

what I want to do is create a finite difference based function to which I can pass different function to be differentiated.

For example:

function ybar = diff_finite ( x , h , function_inquestion) 
  ybar = ((function_inquestion(x+h) - function_inquestion(x)) / h
end

Thanks in advance

看一下函数句柄

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM