科研笔记第11期——k-means聚类算法

目录

一、研究背景

二、研究方法:

三、算例分析

四、源程序(主函数)

五、运行结果

一、研究背景

用电峰谷时期的电量供需不平衡状态在目前仍是一项十分严峻的问题。随着智能电网构建的推进,近年来智能量测终端大量投入使用,中国**计划“十三五”期间全国范围内安装2.3 亿块智能电表,用户的用电数据得以实时采集,反映更多的用户用电规律,这为了解用户的用电特性,提高负荷预测精 度、识别用户用电模式、评估需求响应潜力、指导电价制定等提供了基础。

二、研究方法:

聚类分析作为一种被广泛应用的数据挖掘算法,逐步应用到智能用电领域。在数据挖掘中,海量数据的有效聚类分析是重要 的研究内容,通过对用户负荷数据的分析,可识别用 户用电模式,为用户调节潜力的分析提供依据。用户 用电行为的变化受到诸多因素的影响,本文基于实际 的负荷数据对电力用户进行聚类分析,将负荷曲线特 性相似的分为同一类,相异的分为不同类,对用户的 用电行为进行分析。本文以k-means聚类算法为例对光伏出力场景进行分析。


 

三、算例分析

数据:蒙特卡洛法随机生成的

四、源程序(主函数)

clc;clear all;
filename = '光伏出力.xlsx';
SS= xlsread(filename);
k=size(SS,1);

max_b=max(SS,[],2);
min_b=min(SS,[],2);


for h=1:1:k
    a(h,1)=sum(SS(h,:))/(max_b(h)*24);
end

for i=[1:1:size(SS,1)]
    for j=[1:1:24]
       one_b(i,j)=SS(i,j)/max_b(i);
    end
end

SampleData = one_b;


cluster_num=6;
data=SampleData;
[index_cluster,cluster] = kmeans_func(data,cluster_num);


figure(1)
for ii=1:1:k
if index_cluster(1,ii)==1
    plot(1:24,data(ii,:),'color',[0.5 0.5 0.5],'LineWidth',2)
    hold on
end
end
plot(1:24,cluster(1,:),'r','LineWidth',2)

figure(2)
for ii=1:1:k
if index_cluster(1,ii)==2
    plot(1:24,data(ii,:),'color',[0.5 0.5 0.5],'LineWidth',2)
    hold on
end
end
plot(1:24,cluster(2,:),'r','LineWidth',2)

figure(3)
for ii=1:1:k
if index_cluster(1,ii)==3
    plot(1:24,data(ii,:),'color',[0.5 0.5 0.5],'LineWidth',2)
    hold on
end
end
plot(1:24,cluster(3,:),'r','LineWidth',2)


figure(4)
for ii=1:1:k
if index_cluster(1,ii)==4
    plot(1:24,data(ii,:),'color',[0.5 0.5 0.5],'LineWidth',2)
    hold on
end
end
plot(1:24,cluster(4,:),'r','LineWidth',2)

figure(5)
for ii=1:1:k
if index_cluster(1,ii)==5
    plot(1:24,data(ii,:),'color',[0.5 0.5 0.5],'LineWidth',2)
    hold on
end
end
plot(1:24,cluster(5,:),'r','LineWidth',2)

figure(6)
for ii=1:1:k
if index_cluster(1,ii)==6
    plot(1:24,data(ii,:),'color',[0.5 0.5 0.5],'LineWidth',2)
    hold on
end
end
plot(1:24,cluster(6,:),'r','LineWidth',2)

五、运行结果

本文内容来源于网络,仅供参考学习,如内容、图片有任何版权问题,请联系处理,24小时内删除。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值