Here is the entire code. Trying to fit the data into a piecewise exponential fucntion and testing the maximum likelihood. Where is the mistake. Could not figure it out. Help please..

1 Ansicht (letzte 30 Tage)
The entire code is attached. Please check it out. I spent hours trying to figure the source of the mistake but could not get around it.

Akzeptierte Antwort

John BG
John BG am 2 Jan. 2018
Hi Marwan
when correcting the following line
[mldln,conf1] = mle(xdata,'pdf',@pdfdln,'start',[mu,sig],'upperbound',[5,5], 'lowerbound',[0.1,0.1],'options',options);
with
[mldln,conf1] = mle(xdata,'pdf',@dln,'start',[mu,sig],'upperbound',[5,5], 'lowerbound',[0.1,0.1],'options',options);
then the function produces a histogram, no errors
.
Does it fix it?
if so would you please be so kind to consider marking my answer as Accepted Answer?
To any other reader, if you find this answer useful please consider clicking on the thumbs-up vote link
thanks in advance for time and attention
John BG
  2 Kommentare
Walter Roberson
Walter Roberson am 2 Jan. 2018
Good catch about pdfdln .
It turns out, though, that another fix is required. In the function dbn, right before the for loop you need to add
z = zeros(rs);
This is needed so that the output is the same orientation as the input; without this change, you get a crash in fminsearch that is difficult to track down.
Marwan Abukhaled
Marwan Abukhaled am 2 Jan. 2018
Thank you Walter. This was smart note that I immediately accept it. Together with the above suggestion by *John BG,* the problem is solved.
Thank you for your time and cooperation.

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (1)

Walter Roberson
Walter Roberson am 1 Jan. 2018
You have
[mldln,conf1] = mle(xdata,'pdf',@pdfdln,'start',[mu,sig],'upperbound',[5,5], 'lowerbound',[0.1,0.1],'options',options);
but pdfdln is not a function you define, and is not a Mathworks supplied function or any function I can find anywhere on the Internet.

Community Treasure Hunt

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

Start Hunting!

Translated by