Can mle use a non-anonymous function for a pdf?
1 view (last 30 days)
Show older comments
I am having trouble with mle. Need to use a multi-statement custom pdf. mle works easily with anonymous pdf, but I can't get it to work with a separate script file function. Is this possible? Does anyone have a complete example? I find no answers or examples of this in Matlab's documentation. Thank you.
0 Comments
Answers (1)
David Young
on 30 Apr 2014
Edited: David Young
on 30 Apr 2014
There's no difference between a handle to an anonymous function and a handle to a function in an m-file.
I can think of two possible explanations. One is that your m-file has a script in it, not a function. This is suggested by your use of "script" in your question. The m-file must contain a function, and not a script.
Another possibility is that you aren't generating a function handle properly. If your function is in, say, distribution.m (and is on your path), this is how you'd call mle
phat = mle(data, 'pdf', @distribution, ...)
If neither of those thoughts helps, please edit your question to show the line of code that calls mle and also your m-file for the PDF.
For documention, search for "function handle" in the help window.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!