cdfplot and ecdf differences

19 ビュー (過去 30 日間)
Shahil Khan
Shahil Khan 2021 年 8 月 15 日
コメント済み: Shahil Khan 2021 年 8 月 15 日
Im having some difficulty distinguishing the differences between ecdf and cdfplot. I understand that ecdf calculates it and cdfplot calculates and plots it. The plots they generate are different and produce different stats (mean, median, etc)
My question is, which one is more applicable to use? Are there any differences between these two commands?. Code and graphs to follow.
s = stats_table.Circularity;
histogram(s, 'BinWidth',0.09, ...
'Normalization','cdf')
figure
[f,x] = ecdf(s);
hold on;
plot(x,f)
histogram(s, 'BinWidth',0.09, ...
'Normalization','cdf')
hold off
figure
hold on
[h, stats] = cdfplot(s);
histogram(s, 'BinWidth',0.09, ...
'Normalization','cdf')
hold off

採用された回答

Ive J
Ive J 2021 年 8 月 15 日
編集済み: Ive J 2021 年 8 月 15 日
They're the same (see cdfplot doc), the empirical CDF values are supposed to be used in stairs and not plot (smoothed)
rng('default') % For reproducibility
y = evrnd(0,3,100,1);
cdfplot(y)
hold on
[f, x] = ecdf(y);
stairs(x, f, 'r--')
legend('cdfplot', 'ecdf')
  1 件のコメント
Shahil Khan
Shahil Khan 2021 年 8 月 15 日
Awesome thanks!

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

その他の回答 (0 件)

製品


リリース

R2021a

Community Treasure Hunt

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

Start Hunting!

Translated by