필터 지우기
필터 지우기

Converting Analog Filter into Digital Filter

조회 수: 24 (최근 30일)
Royi Avital
Royi Avital 2011년 5월 25일
Hello. I'm trying to design a simple Digital Filter. The transfer function of the filter is: 1 / s + alpha Where 'alpha' is a parameter (0.2).
Hence the Cutoff frequency is 0.2Hz.
I use the following code:
alpha = 0.2;
fs = 200; % Sample Frequency [Hz]
% Laplace Domain
B = 1;
A = [1, alpha];
w = 0:0.2:(fs / 2);
h = freqs(B, A, w);
figure;
plot(w, abs(h .* conj(h)));
% Digital Filter
[b, a] = bilinear(B, A, fs);
figure;
freqz(b, a, 1000);
As you can see, in the Freqs plot it works well. the Cutoff frequency is indeed 0.2Hz.
Yet it's not in the Digital Filter.
I tried using 'impinvar' as well with the same results.
How can I design the most accurate digital equivalent of this filter?
I'm using MATLAB R2011a.
Thanks.

채택된 답변

Arnaud Miege
Arnaud Miege 2011년 5월 26일
sys_cont = tf(B,A);
sys_disc = c2d(sys_cont,1/fs);
bode(sys_cont,sys_disc,w);
HTH,
Arnaud

추가 답변 (2개)

Arturo Moncada-Torres
Arturo Moncada-Torres 2011년 5월 25일

Your question is too wide, since there are a lot of digital filters that could behave they way you describe. Try using the Filter Design Analysis Tool. Just type

fdatool

It is very easy to use and you can export your results to an mfile so you can use it in your code. Hope it helps!

  댓글 수: 1
Royi Avital
Royi Avital 2011년 5월 25일
Hello,
I'm just looking for the reason the cutoff has changed?
I want to simulate the analog filter I described as good as possible.
For that matter the sampling frequency could get as high as 4800Hz.
Thanks.

댓글을 달려면 로그인하십시오.


Honglei Chen
Honglei Chen 2011년 5월 26일
Hi Royi,
When you use Bilinear transform to convert an analog filter to a digital filter, you need to consider the effect of frequency warping. You can find this information in almost any DSP book such as Oppenheim&Schafer. Basically, if you want your digital filter to have a cutoff frequency at 0.2 Hz, then your analog filter needs to have a corresponding cuttoff frequency before the frequency warping.
HTH.
  댓글 수: 1
Royi Avital
Royi Avital 2011년 5월 26일
First, since the Sampling Frequency >> Cutoff Frequency the transformation is linear up to MATLAB accuracy.
Moreover, if I use 'impinvar' I get the same result, hence that's not the case.
I should have emphasized the target of the conversion between the analog filter and the digital:
Simulating colored noise.
My question is, how do I simulate this analog filter using MATLAB in order to color White Noise.
Thanks.

댓글을 달려면 로그인하십시오.

제품

Community Treasure Hunt

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

Start Hunting!

Translated by