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
댓글 수: 0
답변 (1개)
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])
댓글 수: 0
참고 항목
카테고리
Help Center 및 File Exchange에서 Filter Design에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!