plot smooth CDF using matlab
조회 수: 4 (최근 30일)
이전 댓글 표시
I would like to make the curve smoother, how is that possible?
clear all; close all;
y = [0.75862069 0.666666667 0.882352941 0.875 0.736842105 0.566666667 0.703703704 0.6 0 0.730769231 0.714285714 0.625 0.675 0.693877551 0.731707317 0.558823529 0.679245283 0.740740741 0.785714286 0.789473684 0.615384615 0.6 0.739130435 0.576923077 0 0.75];
cdfplot(y)
댓글 수: 2
Wayne King
2011년 10월 7일
Are you sure that you want to "smooth" an ECDF? I don't think that's a good idea. The ECDF inherently has a staircase appearance and smoothing it distorts the purpose of the ECDF.
What are you trying to gain by smoothing the ECDF?
답변 (2개)
Wayne King
2011년 10월 7일
You could do something like this:
[f,xi] = ksdensity(y);
y1 = cumsum(f);
y1 = y1./max(y1);
x = (1:100)/100;
plot(x,y1,'k','linewidth',2);
hold on;
cdfplot(y);
By using ksdensity() to esimate the density.
Wayne King
2011년 10월 7일
That is because the ECDF necessarily jumps, you could just use ecdf()with confidence bounds
[F,X,Flo,Fup] = ecdf(y);
plot(X,F);
hold on;
plot(X,Flo,'r-.'); plot(X,Fup,'r-.');
will be smoother than
stairs(X,F);
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!