2

I'm programming the montecarlo method for solving integrals. My vector with abscissas is defined inside the routine. As such, i'd like to be able to receive a function to be integrated as an argument in my routine, instead of having to manually change it every time in my code.

How can I do this? Where should I read about this?

Thanks.

DLV
  • 200
  • 1
  • 8
  • With the information you provide, [@surgical_tubing](http://stackoverflow.com/a/32364440/2586922)'s answer is about the best that can be given. If you need more specific help, post a minimal example of your code and explain what you want to do – Luis Mendo Sep 02 '15 at 23:09
  • Here are some decent examples using function handles. http://stackoverflow.com/a/797450/931379 – Pursuit Sep 02 '15 at 23:22
  • Thanks. surgical_tubing's answer has done it for me. – DLV Sep 02 '15 at 23:29

1 Answers1

3

Function handles sound like what you want:

http://www.mathworks.com/help/matlab/ref/function_handle.html