How to get area between 2 cdf curves?
이전 댓글 표시
Hi All,
Iam writing a script to automate the n number of cdfplots to save automatically and among 'n' number of plots i need to choose the best cdf plot automatically. But iam stuck in finding best cdfplot. As i have tried different appraoch to find best cdf plot here are few:
1. Using interpolation method : By taking 1 cdf plot among n cdfplots as an example, interpolating points to curve 1 and curve 2 and taking difference of the each values ( curve1(:,1)-curve2(:,1)) and by keeping threshold after taking differences, I will count how many point are less than threshold in difference array . Similar way I tried doing for n number of plots and based the count as mentioned above I will take max(count) and I find the respective max count index, based on that index I am deciding the best plot. But by trying this method I am not getting desired results.
So I am trying to find the below approach:
2. Area method: Find the area between 2 cdf curve fro each plot and which plot gives me min area I will choose that plot as best cdfplot.
Finding area between curve was easy when we use plot() but uisng cdfplot() I am finding it difficult. So please can some one help in sloving this .
Here is my code for ploting cdf:
eg code:
y= abs(evrnd(0,3,100,1));
x= abs(evrnd(0,4,100,1));
figure(1)
cdfplot(y)
hold on;
cdfplot(x)
legend('cdf1','cdf2')
output :
======

here in the above figure i am trying to find the area between curves as i have marked lines between curves shown in bellow attached figure.

Thanks in advance.
댓글 수: 2
I doubt that this is possible to do correctly. The problem is that the independent variables in the plots are not the same between the functions, and it’s likely not possible to create a common independent variable vector because of the differences between the two of them, and get a reliable result.
y= abs(evrnd(0,3,100,1));
x= abs(evrnd(0,4,100,1));
whos
figure(1)
cp1 = cdfplot(y);
x1 = cp1.XData;
y1 = cp1.YData;
[x1min,x1max] = bounds(x1(isfinite(x1)))
hold on;
cp2 = cdfplot(x);
x2 = cp2.XData;
y2 = cp2.YData;
[x2min,x2max] = bounds(x2(isfinite(x2)))
legend('cdf1','cdf2')
.
Torsten
2023년 6월 3일
You should use the raw data of all the n CDF curves, put them together in one data field and generate the CDF for this data field.
채택된 답변
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Exploration and Visualization에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
