CDF示例代码:
cdf.m
function [xTime,yPercentage]=cdf(initValue,step,endValue,sample); xTime=[]; yPercentage=[]; totalNum=length(sample); for i=initValue:step:endValue temp=length(find(sample<=i))/totalNum; xTime=[xTime,i]; yPercentage=[yPercentage,temp]; end
cdf_app.m
clear; initValue=0; step=0.1; sample1=[0.7,1.2,1.5,2.0,1.3,1.7,2.2,2.5,3.6]; sample2=[0.8,1.1,1.4,2.1,1.2,1.8,2.1,2.4,3.7,4.2,5.4]; endValue1=ceil(max(sample1)); endValue2=ceil(max(sample2)); endValue=max(endValue1,endValue2); [xTime1,yPercentage1]=cdf(initValue,step,endValue,sample1); [xTime2,yPercentage2]=cdf(initValue,step,endValue,sample2); plot(xTime1,yPercentage1,'r'); hold on plot(xTime

本文介绍了如何使用Matlab绘制累积分布函数(CDF)。提供了示例代码`cdf.m`和`cdf_app.m`,并展示了运行效果。在数据处理方面,讨论了从Log文件中提取数据的方法,包括使用Perl脚本和Notepad++的正则表达式功能。还提到了在Matlab中如何将一列数据转换为一行数组的技巧。
最低0.47元/天 解锁文章
2052

被折叠的 条评论
为什么被折叠?



