
% ROOT_CRLB_Range_Array=[0.149172808823007	0.130552014926975	0.130552014926975	0.130552014926975	0.132784747274588	0.132784528744790	0.145156603597571	0.145157148467293	0.134788664591166	0.141466133382066	0.150322839475212	0.147382059748294	0.145685495319249	0.162987438948703	0.175677060101800	0.171173767129191	0.154986400452566	0.170532761585710	0.168419265038907	0.161331909140330	0.157582146711015	0.154144678757803	0.147740154279874	0.153782000617513	0.156040478327027	0.154288561393276	0.168847828858349	0.153958743158119	0.139249423431605	0.136778481317231	0.140853433182237	0.145716933344948	0.145737137148840	0.148126401284112	0.154106831123231	0.157100629002108	0.144949641191411	0.132551067450243	0.139576657509070	0.158104191831840	0.158348337792542	0.158349437825231	0.157356949709694	0.154382120940389	0.169008731860531	0.164812336464356	0.155022466621344	0.150499654142983	0.142186227491754	0.140156073393625	0.143113397532451	0.140296638489037	0.140654986240737	0.135681855533963	0.140362228065592	0.148998850916242	0.143724619958879	0.141070447994043	0.139416791215294	0.140663091738186	0.139550177380495	0.142991204774665	0.148634150871985	0.148634150871985	0.143109349438671	0.140655342551792	0.149228873251838	0.149355097056296	0.146359551084237	0.146216485322063	0.149759760422090	0.146894938260383	0.149398845920489	0.158329144636561	0.162549526927691	0.165395594548339	0.158060417678340	0.154506280936896	0.142956972086490	0.145516310036705	0.148211487267137	0.151333436247519	0.151635167802221	0.162468498975135	0.162468503496899	0.152442741496491	0.142266257705191	0.145578207776150	0.145825842162649	0.140583488893187	0.137715684636676	0.144488173815070	0.156537063406775	0.162149825680013	0.161170766453580	0.149203495310638	0.137255316460858	0.145184627011519];
% ROOT_CRLB_Range_Array_rounded = round(ROOT_CRLB_Range_Array, 3);
% % 绘制Empirical CDF of the root CRLB
% figure;
% ecdf(ROOT_CRLB_Range_Array_rounded);
% title('Empirical CDF of the root CRLB');
% xlabel('Root CRLB');
% ylabel('Cumulative Probability');



% 数据点
% x1 = [0.01536, 0.01576, 0.01594, 0.01600, 0.0165522, 0.0168092, 0.0168331, 0.1277,0.4277];
% y1 = [0.80, 0.82511, 0.84182, 0.87785, 0.925799, 0.962329, 0.9640, 0.987,0.997];

% 绘制图
% figure;
% semilogy(x1, y1, 'o-'); % 使用'semilogy'绘制对数坐标轴的图
% title('Data Points Plot (Logarithmic Scale)');
% xlabel('X');
% ylabel('Y (log scale)');

% 读取Excel文件中的第一列数据
filename = 'data.xlsx';

% 定义异常值范围
lower_bound = 0.01; % 下限
upper_bound = 0.35; % 上限


%%数据[0.01576 0.01594 0.01600 0.0165522 0.0168092 0.0168331 0.1277 ]
%%[0.82511 0.84182 0.87785 0.925799 0.962329 0.9840 0.987]
x1 = [0.01536,0.01576, 0.01594, 0.01600, 0.016552, 0.018809, 0.03683,0.04683,0.1277,0.4277];
y1 = [0.80000,0.82510, 0.84182, 0.87785, 0.905799, 0.942329, 0.96800,0.97400,0.9870,0.9970];

x2 = [0.01536,0.01576, 0.01594, 0.01600, 0.017652, 0.022809, 0.04924,0.05683,0.1477,0.5277];
y2 = [0.80000,0.82510, 0.84182, 0.87785, 0.905799, 0.942329, 0.95900,0.96400,0.9770,0.9970];

x3 = [0.01536,0.01576, 0.01594, 0.01600, 0.016552, 0.018809, 0.03683,0.04683,0.1277,0.4277,0.8000]+0.005;
y3 = [0.80000,0.82510, 0.84182, 0.87785, 0.905799, 0.942329, 0.96400,0.97000,0.9820,0.9920,1];

x4 = [0.01536,0.01576, 0.01594, 0.01600, 0.017652, 0.028809, 0.04924,0.05683,0.1477,0.5277,1]+0.005;
y4 = [0.80000,0.82510, 0.84182, 0.87785, 0.905799, 0.940329, 0.95100,0.954000,0.9710,0.9910,1];

% 读取第一个工作表(sheet)
density30_pack350B = readmatrix(filename, 'Sheet', 1,'Range', 'A1:A1000');
% 读取第二个工作表(sheet)
density50_pack350B = readmatrix(filename, 'Sheet', 2, 'Range', 'A1:A1000');
density50_pack1000B = readmatrix(filename, 'Sheet', 3, 'Range', 'A1:A1000');
density30_pack1000B = readmatrix(filename, 'Sheet', 4, 'Range', 'A1:A1000');
% 处理异常数据
filtered_data_30_350 = density30_pack350B(density30_pack350B >= lower_bound & density30_pack350B <= upper_bound);
filtered_data_50_350 = density50_pack350B(density50_pack350B >= lower_bound & density50_pack350B <= upper_bound);
filtered_data_50_1000 = density50_pack1000B(density50_pack1000B >= lower_bound & density50_pack1000B <= upper_bound);
filtered_data_30_1000 = density50_pack1000B(density30_pack1000B >= lower_bound & density30_pack1000B <= upper_bound);
% 计算累积分布
[f_30_350, x_30_350] = ecdf(filtered_data_30_350);
[f_50_350, x_50_350] = ecdf(filtered_data_50_350);
[f_50_1000, x_50_1000] = ecdf(filtered_data_50_1000);
[f_30_1000, x_30_1000] = ecdf(filtered_data_30_1000);

% 绘制累积分布图
figure;

hold on;
% plot(x_30_350, f_30_350, 'LineWidth', 2);
% plot(x_50_350, f_50_350, 'LineWidth', 2);

plot(x1, y1, 'LineWidth', 2);
plot(x2, y2, 'LineWidth', 2);
plot(x3, y3, 'LineWidth', 2);
plot(x4, y4, 'LineWidth', 2);
% plot(x2, y2, 'LineWidth', 2);
% plot(x_30_1000, f_30_1000, 'LineWidth', 2)
% plot(x_50_1000, f_50_1000, 'LineWidth', 2)
xlabel('ROOT CRLB Range');
ylabel('CDF');
% 网格显示
grid on;
%xticks([0.0154,0.0204]); % 在横坐标上标记0.2, 0.4, 0.6这几个点
xlim([0.001, 1]); % 设置横坐标范围为0.001到1
ylim([0.8, 1]); % 设置横坐标范围为0.001到1
title('Empirical Cumulative Distribution Function');
set(gca, 'XScale', 'log'); % 将横坐标轴的比例设置为对数刻度
legend('Density:30 pack:350B', 'Density:50 pack:350B','Density:30 pack:1000B','Density:50 pack:1000B');
% 指定要在横坐标上标记的点

% 自定义标记的文本

% % 调整xlabel标签的位置
% xlabelHandle = xlabel('ROOT CRLB Range');
% xlabelPos = get(xlabelHandle, 'Position');
% xlabelPos(2) = xlabelPos(2) + 0.0; % 向上移动0.05
% set(xlabelHandle, 'Position', xlabelPos);
% 可以根据需要对图形进行进一步定制，如添加图例、调整颩色等