Why does findchangepts doesn't work right?

조회 수: 9 (최근 30일)
Stwiwi
Stwiwi 2018년 9월 17일
편집: Greg Dionne 2018년 9월 17일
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
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
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)

카테고리

Help CenterFile Exchange에서 Descriptive Statistics에 대해 자세히 알아보기

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by