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
David Young 2014년 4월 30일
편집: David Young 2014년 4월 30일

0 개 추천

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.

댓글 수: 1

Thank you David Young. I'll work on it a bit and try to boil it down to a concise set of statements.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Scripts에 대해 자세히 알아보기

질문:

2014년 4월 30일

댓글:

2014년 4월 30일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by