Why does findchangepts doesn't work right?
조회 수: 1 (최근 30일)
이전 댓글 표시
Hey guys, For the attached data file i use the following code so i can find the areas for each of the four separate waves:
D = load('008a_100Hz.mat');
Ch9 = D.Channel_9_Data;
tv = D.Channel_1_Data; % Time Vector
[lpt,rsd] = findchangepts(Ch9, 'Statistic','rms', 'MaxNumChanges',8);
for k1 = 1:2:numel(lpt)-1
sig_seg{(k1+1)/2,1} = Ch9(lpt(k1):lpt(k1+1)); % Signal Values At Each Segment
sig_seg{(k1+1)/2,2} = lpt(k1):lpt(k1+1); % Index Range
end
vl = bsxfun(@times, ones(numel(lpt), 2), [min(Ch9) max(Ch9)]); % Create Vertical Lines For ‘figure(1)’
figure(1)
plot(tv, Ch9)
hold on
plot([tv(lpt),tv(lpt)]', vl', '-r', 'LineWidth',1.5)
hold off
grid
With the code I get sth. like this:
The second vertical line should be on the right of the first waves. Any ideas how that might work? Thanks people:)
댓글 수: 1
jonas
2018년 9월 17일
Related Q
https://se.mathworks.com/matlabcentral/answers/418641-how-to-create-plots-for-special-areas-of-an-array
답변 (1개)
Greg Dionne
2018년 9월 17일
편집: Greg Dionne
2018년 9월 17일
If you have R2016b or later try:
Fs = 100;
[sst,f] = fsst(Ch9,Fs,kaiser(512,10));
fridge = tfridge(sst,f,10,'NumRidges',1);
findchangepts(fridge,'Statistic','mean','MaxNumChanges',8)
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Multirate Signal Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!