Can mle use a non-anonymous function for a pdf?
이전 댓글 표시
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.
답변 (1개)
David Young
2014년 4월 30일
편집: David Young
2014년 4월 30일
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.
카테고리
도움말 센터 및 File Exchange에서 Scripts에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!