using 'controlchart' and 'findpeaks'
古いコメントを表示
Hello everybody. I’m using the function “controlchart” to analyze something like the data in the picture, however I was wondering how to use the ‘’findpeaks’’ function to identify the peaks in the red circles and also the width of those peaks. Apparently the ‘’findpeaks’’ function doesn’t work properly in this case, it is possible to use both functions in one chart?. Thank you.

1 件のコメント
Mathieu NOE
2021 年 4 月 13 日
hello
we could probably better help you if you share a code and data
tx
採用された回答
その他の回答 (1 件)
Fercho_Sala
2021 年 4 月 15 日
編集済み: Fercho_Sala
2021 年 4 月 15 日
3 件のコメント
Star Strider
2021 年 4 月 15 日
I was thinking of something like this —
ax9=subplot(1,2,1);
% load parts;
st2 = controlchart(pws1,y,'Parent',ax9);
ax9.YGrid = 'on';
ax9.XGrid = 'on';
ax9.Children(1).Color = 'w';
ax9.Children(2).Color = 'w';
Kids = ax9.Children(4);
xcc = Kids.XData;
ycc = Kids.YData;
[pks,locs] = findpeaks(ycc, 'MinPeakProminence',1);
figure(9)
plot(xcc, ycc)
hold on
plot(xcc(locs), ycc(locs), '^r')
hold off
grid
xlim([min(xcc) max(xcc)])
ylim([min(ylim) max(ylim)+4])
title('Points Plotted On Control Chart')
xlabel('X Vector')
ylabel('Y Vector')
legend('Points','Peaks', 'Location','best')
text(xcc(locs), ycc(locs), compose('(%3d, %.2f) \\rightarrow ', [xcc(locs); pks].'), 'Horiz','right', 'Vert','middle', 'Rotation',-45)
producing this plot —

Experiment to get different results. (I had to use return after that code to get it to plot correctly, since it does not automatically open a new figure window, for some reason.)
Fercho_Sala
2021 年 4 月 15 日
Star Strider
2021 年 4 月 15 日
As always, my pleasure!
I definitely agree!
カテゴリ
ヘルプ センター および File Exchange で Statistics and Linear Algebra についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!