2014-11-07 4 views
3

설명이 약간 복잡합니다. 다음과 같이 포맷 된 시계열 데이터가 있습니다. https://docs.google.com/spreadsheets/d/1B8mN0uD-t4kQr2U20gS713ZFHN6IgGB7OMR3-pqJjrw/edit?usp=sharingMatlab timeseries 데이터에서 임계 값 교차점을 찾은 후 다음 임계 값 교차점을 찾기 전에 60 초 동안 후속 교차점을 무시하십시오.

이 데이터는 .01s 간격으로 전압 기록을 나타냅니다. 플롯하는 경우는 다음과 같습니다 : 기본적으로

http://i.imgur.com/yatlBLt.jpg .

은 제가하고 싶은 것은 (각 매우 좁은 쌍의 첫 번째 피크가 발생하는 시간을 찾을 예에 ~ 0.1, 0.75, 1.6, 등).

시간 값은 별도의 배열이지만 인덱스 값 (행 번호)은 두 세트 사이에서 일치합니다.

방법에 대한 아이디어가 있으십니까?

내 초기 시도는 MATLAB 설명서에서이 같은

function [edges2] = risingEdge2(time, data) 
threshold = 0.4; 
offsetData = [data(2:end); NaN]; 
edges2 = find(data < threshold & offsetData > threshold); 
end 

내가 처음 피크 후 n 초에 대한 무시하는 좋은 방법을 알아낼 수 없었다 ... 나는 또한 더 많은납니다이었다 예상보다 높은 피크 ... 아마도 시끄러운 데이터 때문일 수 있습니다.

+1

시도했지만 문제가 있습니까? – AnonSubmitter85

+0

신호 처리 도구 상자를 사용할 수 있습니까? –

+0

@ AnonSubmitter85가 방금 내 시도로 업데이트했습니다. – user3746901

답변

0

주어진 데이터에 대해 다음 접근 방식이 효과가있는 것으로 보입니다. 위의 그림을 확대하면

%// Define parameters 
window_size = 200; 
stepsize = 0.4; %// to be used for quantizing data into three levels - 0, 0.4, 0.8 

%// Perform a sliding max to get rid of the dips within the spikes 
slmax_data = nlfilter(data,[window_size 1],@max); 

enter image description here

%// Quantize sliding max data to three levels as the plot seem to suggest 
quantized_slmax_data = round((slmax_data-min(slmax_data))./stepsize); 

enter image description here

, 당신은 높은 봉우리 주변에 선반을 볼 수 -

enter image description here

%// Get sliding mode to get rid of the short ledges around the high peaks 
slmax_mode_data = nlfilter(quantized_slmax_data,[window_size 1],@mode); 
,

enter image description here

%// Finally, find the indices where the mode data jump from 0 to 1 only, which 
%// correspond to the start of spikes 
index = find(diff(slmax_mode_data)==1)+window_size/2; 

출력 - 여기

index = 
     682 
     8048 
     16487 
     24164 
     31797 
+0

아,이 솔루션을 좋아합니다. 나는 그것이 작동하도록 할 수 없습니다. 나는 nlfilter에 익숙하지 않다 ... 나는 'function_handle'유형의 입력 인자에 대해 정의되지 않은 함수 'nlfilter'를 계속해서 오류가 발생한다. 편집 : 나는 이미지 처리 도구 상자를 설치해야한다고 생각해. – user3746901

+0

@ user3746901 예 이미지 Proc. 이 코드를 사용하려면 도구 상자가 필요합니다! 어떻게 진행되는지 알려주시겠습니까? – Divakar

0

- 모든 상승 에지를 발견하고 서로 매우 가까운 그 사람들을 찾아 처음을.

rising_edges = find(diff(data > .3) > 0); 
first_of_paired_edges = find(diff(time(rising_edges)) < 500); 

first_rising_edge_times = time(rising_edges(first_of_paired_edges)); 

다음으로 가장자리를 위로 밀어 올릴 수 있습니다.

first_peak_times = time(arrayfun(@(n) n+find(diff(data(n+[0:1000]) < 0, 1, 'first'), 
         rising_edges(first_of_paired_edges));