Filter amplitude vs time data

조회 수: 4 (최근 30일)
ignacio bobadilla tapia
ignacio bobadilla tapia 2021년 6월 2일
댓글: ignacio bobadilla tapia 2021년 6월 2일
Dear,
Along with saying hello, I wanted to ask for your help please. I need to identify the wave with the greatest amplitude (maximum peak), and intersect it with a threshold value, in this case of 1.5, and identify the points of intersection, that is, the nodes where the curve of the maximum peak intersects with the threshold value, to to be able to identify node 1 and node 2 with respect to the horizontal axis (time series), for which I attach the data, and an image of the problem. Best regards.
close all, clear all, clc
data=load('D:\HP CIVIL\serie de tiempo\data.txt');
t=0:10:4*3600;
plot(t,data)
xlabel('Time (s)'); ylabel('Amplitude (m)')
hold on
plot(t,1.5,'r')

답변 (1개)

KSSV
KSSV 2021년 6월 2일
data=load('data.txt');
t=(0:10:4*3600)';
[val,idx] = max(data) ;
ti = (0:0.05:4*3600)' ;
datai = interp1(t,data,ti) ;
id1 = abs(datai-1.5)<=0.001 ;
ti_th = ti(id1) ;
datai_th = datai(id1) ;
id2 = knnsearch([ti_th datai_th],[t(idx) data(idx)],'k',2) ;
plot(t,data)
xlabel('Time (s)'); ylabel('Amplitude (m)')
hold on
plot(ti_th,datai_th,'.r')
plot(ti_th(id2),datai_th(id2),'Ok')
  댓글 수: 2
ignacio bobadilla tapia
ignacio bobadilla tapia 2021년 6월 2일
Estimated,
Along with saying hello, what I need specifically is to calculate the time differential of the intersection of the threshold (1.5) with the curve of maximum amplitude, for which I attach an explanatory image.
Thanks greetings.
ignacio bobadilla tapia
ignacio bobadilla tapia 2021년 6월 2일
Estimated, don't you have some simpler code? Regards.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Smoothing and Denoising에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by