Can mle use a non-anonymous function for a pdf?

6 ビュー (過去 30 日間)
jeff bodington
jeff bodington 2014 年 4 月 30 日
コメント済み: jeff bodington 2014 年 4 月 30 日
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 日
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 件のコメント
jeff bodington
jeff bodington 2014 年 4 月 30 日
Thank you David Young. I'll work on it a bit and try to boil it down to a concise set of statements.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeScripts についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by