提供的下载资源“MATLAB中pettitt突变检测与绘图”代码中,图例存在bug。请按照以下加粗部分代码修改。
p1 = plot(data(2:m,1),U,'k-','linewidth',1.5);%画出整个曲线的变化趋势
p2 = plot([data(loc+1,1),data(loc+1,1)],[-K,K],'r--','linewidth',1.5); %画出该竖线即为突变点
......
p3 = plot([data(1,1),data(m,1)],[-klim,-klim],'b-.');
plot([data(1,1),data(m,1)],[klim,klim],'b-.');
.......
p4 = plot([data(1,1),data(m,1)],[-klim,-klim],'b--');
plot([data(1,1),data(m,1)],[klim,klim],'b--');
.......
p5 = plot([data(1,1),data(m,1)],[-klim,-klim],'b:');
plot([data(1,1),data(m,1)],[klim,klim],'b:');
legend([p1,p2,p3,p4,p5],'UT','T0','p<0.5','p<0.05','p<0.01');