simple low pass filter - matlab equivalent

7 ビュー (過去 30 日間)
Albin
Albin 2016 年 5 月 27 日
回答済み: Star Strider 2016 年 5 月 27 日
Hi every one.
could anyone tell me a fast matlab equivalent to the following low-pass filter:
clc
clear
close all
tau = 0.5;
freq = 10;
weight = 2-exp(1./(tau*freq));
samplesize = 30000;
a = [1:samplesize]';
b = rand(samplesize,1).*20+390 + sin(a./10).*10;
%LowPass Filter
lp = NaN(size(a));
lp(1) = b(1);
for i = 2:length(a)
lp(i) = lp(i-1).*weight+b(i).*(1-weight);
end

回答 (1 件)

Star Strider
Star Strider 2016 年 5 月 27 日
It looks like an fir filter. When I analyse it with freqz, it turns out ot be a very strange filter, and almost a comb filter. I have no idea how to approximate it with Signal Processing Toolbox functions (other than perhaps fir1 or related functions) because I have no idea what you want it to do.
Run this to see the filter Bode plot. Change the upper limit in the set call (currently 0.02) to see more of the plot. Change the exponent in 2^15 to change the resolution:
figure(1)
freqz(lp, 1, 2^15)
set(subplot(2,1,1), 'XLim', [0 .02])
set(subplot(2,1,2), 'XLim', [0 .02])

カテゴリ

Help Center および File ExchangeFilter Design についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by