How to filter data in a temporally causal way?
조회 수: 2 (최근 30일)
이전 댓글 표시
I'm trying to filter a signal, but I've encountered something that I'm not sure how to overcome at the moment.
I am trying to implement a filter that would work in the same manner in offline filtering as in online filtering. What I mean is, the filter should act in a causal way; it shouldn't "read the next few data points" to decide how to alter the current signal.
If I try:
band=[100 200]
sampfreq=1000;
[A,B]=butter(4,band/sampfreq*2);
data=zeros(10000,1);
data(5000:5100)=1;
fdata=filtfilt(A,B,data);
figure;hold on;
plot(data,'b');plot(fdata,'r');
xlim([4900,5200]);
Then it results in the following figure:

This doesn't make sense to me as a model of an online filter because it violates causality; the red ripples appear in the filtered data before the change occurs in the input data. How can I design a filter which works in a causal way and only responds to changes in the input that have already occurred from a temporal standpoint?
Thank you.
댓글 수: 0
답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 Digital Filtering에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!