Real Time Low Pass Filtering

71 ビュー (過去 30 日間)
tinkyminky93
tinkyminky93 2023 年 1 月 31 日
コメント済み: tinkyminky93 2023 年 1 月 31 日
Hello,
I am trying to apply the low pass filter to my data. My samples are like square wave and I want them to be smoother. In order to do that, I am using low pass filter. This works fine for offline operations, I mean, I have all the data and time vector, so it is easy to filter the data. But I want to do it real-time with minimum delay, like 1 sample delay. Here is my .mat files and graphs that I got.
clc
clear
close all
temperature = load("C:\Users\User\Desktop\Samples.mat");
% Samples.mat have temperature data.
filtered_temperature = lowpass(temperature, 1, 1000);
plot(filtered_temperature)
hold on
plot(temperature)
% temperature.mat and filtered_temperature.mat attached.
Thanks for your help.

回答 (1 件)

Benjamin Thompson
Benjamin Thompson 2023 年 1 月 31 日
All digital filters working in real time must have some delay, this is a law of filtering in general. The amount of delay depends on the type of filter, how fast the passband falls off, etc. You can use the "fir" option of lowpass to ensure an FIR (finite impulse response) type filter which has constant delay in time. Then if you have a data file, your problem is not "real time", right? The delay of an FIR filter is equal to the order or number of coefficients in the filter. So just adjust the time values of the output so they line up with the original time values.
  1 件のコメント
tinkyminky93
tinkyminky93 2023 年 1 月 31 日
Actually I haven't got data file always. It is sampling the temperature data and sends them to me without .mat format. I merged them manually so we can say that it is real time. For example it is sampling with 1000 Hertz until I power off my device. I need to do it online, not offline with 500 datas. Other things that you mentioned are right, it is a law of filtering. Can we do it without filter, any advice about it sir? Thanks.

サインインしてコメントする。

カテゴリ

Help Center および File ExchangeStatistics and Linear Algebra についてさらに検索

製品


リリース

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by