Fitdist gives wrong answer
3 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Emmeirrt
il 5 Gen 2024
Commentato: Star Strider
il 29 Gen 2024
fitdist is givin me mu of 6.43686 with this code. Am i doing something wrong. I'm trying to get mu and sigma values to compare this data with log normal distribution
Add=16
%%info given in question 4
River_flood_level=[516 678 802 683 491 582 625 531 451 726 652 556 470 570 774 670 432 604 881 707 735 614 698 403 548 504 758 1000 419];
River_flood_level=River_flood_level+Add;
%%solution of question 4
fitdist(River_flood_level.','Lognormal')
1 Commento
Paul
il 5 Gen 2024
Why do you think the result is incorrect? What are you expecting mu to be?
The fitted distribution looks pretty reasonable given the limited amount of data provided.
Add=16;
%%info given in question 4
River_flood_level=[516 678 802 683 491 582 625 531 451 726 652 556 470 570 774 670 432 604 881 707 735 614 698 403 548 504 758 1000 419];
River_flood_level=River_flood_level+Add;
%%solution of question 4
p = fitdist(River_flood_level.','Lognormal');
figure
histogram(River_flood_level,'Normalization','pdf')
hold on
plot(400:1200,pdf(p,400:1200))
Risposta accettata
Star Strider
il 5 Gen 2024
The μ and σ values are in log units. Calculatee their exponentials —
Add=16
%%info given in question 4
River_flood_level=[516 678 802 683 491 582 625 531 451 726 652 556 470 570 774 670 432 604 881 707 735 614 698 403 548 504 758 1000 419];
River_flood_level=River_flood_level+Add;
%%solution of question 4
df = fitdist(River_flood_level.','Lognormal')
Mean = exp(df.mu)
Sigma = exp(df.sigma)
figure
hf = histfit(River_flood_level.', 10, 'Lognormal');
hold on
Line = findobj(hf,'Type','line');
ymu = interp1(Line.XData, Line.YData, exp(df.mu));
plot(exp(df.mu)*[1 1], [0 ymu], ':r', 'LineWidth',3)
hold off
Ax = gca;
Ax.XTickLabelRotation = 60;
.
6 Commenti
Star Strider
il 29 Gen 2024
As always, my pleasure!
No worries!
Thank you for the follow-up (and for Accepting my Answer).
Più risposte (0)
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!