simple low pass filter - matlab equivalent

7 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 Filter Design 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by