Filter time-variant data and reduce its length

조회 수: 1 (최근 30일)
zhi liu
zhi liu 2020년 4월 26일
댓글: Ameer Hamza 2020년 4월 26일
Hi experts,
I have a time-variant test data. The 1st column is time, and the 2nd column is data. There is a serious fluctuation of it. I want to filter the data and at the same time want to reduce its length.
Could somebody guide me how to do this? Thank you!

채택된 답변

Ameer Hamza
Ameer Hamza 2020년 4월 26일
It seems like you are trying to plot step-response of a system. Try something like this
data = load('data.csv');
t = data(1:100,1);
y = data(1:100,2);
y = smoothdata(y, 'sgolay', 20);
plot(t, y)
It reduces the length by taking the first 100 elements and smoothening the signal.
  댓글 수: 2
zhi liu
zhi liu 2020년 4월 26일
I want to get the full-response but a shorter data is needed. Is there suitable method? Thank you!
Ameer Hamza
Ameer Hamza 2020년 4월 26일
Yes, The system reaches its steady-state after a few seconds. The rest of the data is redundant. This gives the full response of the system.

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

추가 답변 (1개)

Thiago Henrique Gomes Lobato
Thiago Henrique Gomes Lobato 2020년 4월 26일
Take a look at medfilt1 and/or movmean. They sould help you reduce the fluctuations. To reduce the data length you just index the time you want:
idx1 = 100;
idx2 = 900;
Data = Data(idx1:idx2,:); % Data = Length x 2 matrix
In this example your data will go only from meausurement point 100 to measurement point 900.

카테고리

Help CenterFile Exchange에서 Single-Rate Filters에 대해 자세히 알아보기

태그

제품

Community Treasure Hunt

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

Start Hunting!

Translated by