How to filter data in a temporally causal way?

2 ビュー (過去 30 日間)
sublimed
sublimed 2016 年 5 月 21 日
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 件)

カテゴリ

Help Center および File ExchangeDigital Filtering についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by