matlab pareto 升级版

it2022-05-09  32

由于pareto 只能最多显示10列数据,及使用其他命令显示10组以外的数据时效果也不理想,(超过十没有坐标)。

此时我写了一个函数功能类似,感觉更加完善一点:

function ze=mypareto(a,b)%作用:显示累加后所占总数据的百分比%a:整形,为输入的数据列数。b:输入的1*a实际数据,格式:[12, 23, 23, 34,....]y=100*b/sum(b);x=1:a;kk(1)=y(1);for index=2:a kk(index)=kk(index-1)+y(index);endbar(y);hold onset(gca,'xtick',0:1:25)%设置Y轴间隔自然用ytick,用法类推。其中gca代表Current axes handle(当前坐标轴句柄)set(gca,'ytick',0:10:100)grid on %图像显示方格plot(x,kk);xlabel('Principal Component');ylabel('Variance Explained (%)');hold off

图像对比:

pareto:

mypareto:

转载于:https://www.cnblogs.com/sunwufan/archive/2011/08/29/2158014.html

相关资源:matlab开发-ParetoSet

最新回复(0)