Mengapa filter digital berfungsi?


8

Jadi saya baru saja mulai membaca filter FIR dan IIR dan saya kagum dengan betapa "sederhana" teorinya, sejauh ini.

  • Tapi yang membingungkan saya adalah, mengapa penyaringan bekerja dengan membuat jumlah tertimbang dari sampel sebelumnya?

  • Intuisi apa yang membuat orang berpikir ini dapat menghasilkan efek penyaringan yang diinginkan?

  • Tampaknya agak tidak intuitif bagi saya walaupun ada yang bisa memverifikasi bahwa menjumlahkan sinyal yang tertunda bersama-sama menghasilkan penyaringan sisir. Tapi pemfilteran yang diinginkan? Mengapa?

3
Ini bekerja karena menghitung lilitan.
MBaz

uhm, ini agak seperti interpolasi Lagrange . Anda dapat mengajukan pertanyaan yang sama: "Intuisi apa yang membuat orang berpikir ini dapat menghasilkan efek [interpolasi] yang diinginkan?" ada banyak koefisien yang harus Anda atur dengan benar. bagaimana seseorang mengaturnya? mengikuti kursus matematika dan / atau EE. ini semacam masalah sistem persamaan: persamaan 2N dan 2N tidak diketahui.
robert bristow-johnson

@ robertbristow-johnson Tetapi algoritma interpolasi dimulai dengan semacam asumsi. Seperti bahwa polinomial interpolasi harus merupakan polinomial derajat-k antara titik interpolasi dan misalnya asumsi kontinuitas. Apakah penyaringan memiliki asumsi yang sama yang mengarah pada definisi fungsi penyaringan?
mavavilj

@avavilj, ya. baik, tidak, tidak begitu banyak "asumsi" . penyaringan merek penggunaan spesifikasi dari "band lulus" dan "berhenti band" dan "band transisi" , dan kami mencoba untuk mengatur koefisien FIR atau IIR alih fungsi sedemikian rupa untuk memenuhi spesifikasi tersebut.
robert bristow-johnson

Jawaban:


14

Pertimbangkan sinyal input waktu diskrit dari formulir:

x[n]=cos(ω0n)

di mana frekuensi radian ω0 diatur antara 0 dan π radian per sampel.

Sekarang, pertimbangkan dua jenis filter LTI FIR diskrit waktu (digital) sederhana yang didefinisikan melalui operasi aritmatika dasar penambahan dan pengurangan sampel input mereka dan kemudian menghasilkan outputy1[n] dan y2[n] berdasarkan:

y1[n]=(x[n]+x[n1])/2   ,   sum filter
dan
y2[n]=(x[n]x[n1])/2   ,   difference filter

Mari kita membuat analisis kualitatif dari filter ini dengan mengatur frekuensi sinyal input mereka ω0ke rendah (dekat dengan0) dan tinggi (dekat denganπ) nilai, dan kemudian mengamati output yang sesuai y1[n] dan y2[n] masing-masing;

Pertama, asumsikan itu ω0diatur ke frekuensi rendah. Kemudian sampel input berturut-turutx[n] dan x[n1]akan memiliki nilai yang sangat mirip , karena gelombang sinus frekuensi rendah tidak akan banyak berubah dari satu sampel ke yang lain. Ketika hal ini terjadi, jumlah mereka akan bertambah , sedangkan perbedaannya akan dibatalkan . Karena ituy1[n] akan kira-kira sama dengan nilai input x[n], sedangkan output y2[n]akan mendekati nol karena membatalkan. Bagian pertama dari analisis kualitatif menyimpulkan bahwa filter pertama,y1[n], melewati sinyal frekuensi rendah sementara filter kedua, y2[n] melemahkan mereka.

Asumsikan untuk bagian kedua dari analisis itu ω0diatur ke frekuensi tinggi ; maka nilai-nilai dari sampel inputx[n] dan x[n1]akan polaritas yang berlawanan , karena cosinus akan dengan cepat berubah dari sampel ke sampel. Ketika hal ini terjadi, maka jumlah mereka akan dibatalkan , sedangkan perbedaannya akan bertambah . Karena ituy1[n] akan menjadi sekitar nol, sedangkan output y2[n] akan mirip dengan inputnya x[n]. Bagian kedua dari analisis menyimpulkan bahwa filter pertama,y1[n], menghentikan sinyal frekuensi tinggi sementara filter kedua, y2[n], melewati mereka.

Menggabungkan dua analisis kualitatif ini kami menyimpulkan bahwa filter pertama y1[n]=0.5(x[n]+x[n1])adalah filter lowpass , yang melewatkan frekuensi rendah dan melemahkan frekuensi tinggi, sedangkan filter keduay2[n]=0.5(x[n]x[n1])adalah filter highpass , yang mengurangi frekuensi rendah dan melewati frekuensi tinggi.

Dalam pengaturan ini, filter yang lebih kompleks diwujudkan dengan menggunakan lebih banyak sampel dari penundaan lebih jauh yang diberi bobot yang sesuai. Frekuensi passband dan stopband cutoff, bandwidth transisi dan riak semuanya ditentukan oleh bobot yang diterapkan ke penjumlahan (atau perbedaan) sampel dan jumlah sampel (panjang filter) yang digunakan dalam penjumlahan (atau perbedaan).

Bobot-bobot tersebut kemudian disebut sebagai koefisien filter (atau respons impulsnya)h[n] untuk filter FIR) yang mencirikan filter.


3

Anda mungkin telah menggunakan banyak penyaringan. Rata-rata bergerak adalah filter!

Bayangkan penyaringan umum sebagai melakukan rata-rata bergerak mewah di mana daripada rata-rata setiap komponen dalam jendela sama, Anda menimbang komponen.

Jika Anda hanya ingin menghaluskan sinyal, Anda dapat menimbang setiap nilai yang digunakan dalam rata-rata dengan kurva Gaussian (bel) misalnya. Ini adalah filter low pass.

Jika Anda ingin mengisolasi frekuensi tertentu, Anda dapat menimbang setiap nilai sebagai alternatif positif dan negatif pada frekuensi yang sama.


Hai: semua jawaban luar biasa dan memberikan sudut pandang yang luas dan beragam. Saya berasal dari domain waktu sehingga jawaban ini sangat menarik dan menyalakan banyak bola lampu yang bahkan tidak saya ketahui tidak aktif. terimakasih banyak.
tanda leeds

3

Saya pikir Anda mencari intuisi mengapa Anda mendapatkan perilaku domain frekuensi tertentu saat menghitung jumlah sampel input tertimbang. Seperti yang Anda tahu, sinyal keluaran panjang kausalN Filter FIR diberikan oleh

(1)y[n]=k=0N1h[k]x[nk]

dimana h[n] adalah koefisien filter (keran), atau, ekuivalen, respons panjang impuls filter yang terbatas, dan x[n] adalah sinyal input.

Sekarang mari x[n]=ejω0n, yaitu eksponensial kompleks pada frekuensi ω0. Sinyal keluaran yang sesuai adalah

(2)y[n]=k=0N1h[k]ejω0(nk)=ejω0nk=0N1h[k]ejω0k=ejω0nH(ω0)

where

(3)H(ω)=k=0N1h[k]ejωk

is the frequency response of the filter, evaluated at ω=ω0. It equals the discrete-time Fourier transform of the impulse response h[n].

Eq. (2) shows how an input frequency component at frequency ω0 appears at the output. Its amplitude is scaled by |H(ω0)|, and its phase is shifted by arg{H(ω0)}. As an example, you could choose the coefficients h[n] such that H(ω0)=0 for a certain frequency ω0. In this case, the corresponding frequency component in the input signal is completely suppressed by the filter. This is what notch filters do.

Eq. (2) explains the frequency domain behavior of a discrete-time filter. You can approximate any desired frequency response D(ω) by H(ω) by choosing the coefficients h[n] in an appropriate way. This is the topic of approximation theory, or, more specifically, (frequency-domain) design of digital filters. Have a look at this answer for a brief overview of digital filter design and for some references.


3

To the useful answers that have been added so far, I would like to add, on the point of intuition, that filtering works because it is based on Wave theory and specifically, the interaction of waves. This provides a huge array of intuitive examples.

But also, that there are basically two viewpoints. One is the abstract viewpoint, taken by modelling reality and then working with the models and the other one is the "physical" reality. That is, what is actually happening in nature.

For example, in reality, sound from a source bounces off of a wall and comes back at the ears of the listeners. This is reality. "Modelling" reality is to say that the wall is just a detail. What is happening is that there is another source, at a well defined location BEHIND the wall that is playing back the sound of the source. This simple model then allows reflections to be studied as the addition of waves...But there is nothing on the other side of the wall.

y=a×cos(ωt+ϕ) is an oscillator. If it was coming out of a function generator, on top of a bench, we could say that y corresponds to the jack of the output, a is the amplitude dial, ω is the frequency dial and ϕ is the phase dial. So, each one of our abstract symbols has a physical meaning. We can play with the frequency dial and it immediately becomes accessible to us, it becomes part of our experience.

Can we play with that h that Matt. L is talking about in his response further above? What is the physical correspondence of h? What is actually happening in reality? What is h?

h is many wonderful things. A room is an h. A long tunnel passage under a bridge is an h. The atmosphere is an h. A piano is an h (generally, the resonators of instruments). The ocean is an h. A piece of wire is an h. A guitar amplifier is an h.

Imagine yourself in what we call free space. Free space is space so big that your voice falls flat, it doesn't resonate at all. It's a very strange feeling. To realise what "flat" really means, you have to find yourself in a shop that sells fabrics (or an unechoic chamber...the fabric shop is easier). All the merchandise absorbs sound so much that you get a sense of complete isolation and without any sense of direction.

But anyway, we are in free space and we have that function generator on a speaker somewhere in front of us. Turn it on. You hear the crystal clear sound of a whistle. The speaker sets the air in vibrating motion and eventually the waves reach our ears.

We now bring in a flat sheet of granite. It is a large sheet of granite on wheels and we can position it anywhere we like, we position it somewhere behind us and observe that when we move at a specific location between the speaker and the granite sheet, the sound reduces in amplitude, until it disappears completely. Why is this happening? Because the peaks of the waves that the speaker produces in front of us, combine (perfectly) with the troughs of the waves that are produced by the phantom speaker behind us (or actually, the fact that the same waves from the speaker, bounce off of the granite sheet and recombine. By the way, because of the physics of this bouncing, wherever you have a reflection, the phase of the reflected signal is flipped). Therefore, where the front speaker creates some pressure, the rear speaker (the reflection) creates some "suction" and the air effectively doesn't move.

What does this have to do with h?

Let's start with an "empty" h. No, it's not all zeros, it looks like this h=[1,0,0,0,0,0,0,0]. The signal that hits the ears is z=yh. The here denotes the convolution from Matt. L's response above. With this h, z is identical to y. This is us in free space. We now bring in the granite sheet detail. How does this change h?

Could be something like this h=[1,0,0,0,0,1,0,0,0,0]. Which represents 1 bounce some time later than the immediate forward wave reaching our ears. If the distance between the two 1s corresponds to half a wavelength of the frequency of our generator, z will be zero. Other wavelengths will be cancelling out proportionally.

So...We can carve the harmonic spectrum of z...by careful placement of echoes in h...

Now, forget about gravity. We float in free space (not outer space) and we bring in sheets of granite, sheets of plywood, sheets of plywood covered in fabric, sheets of really thick fabric, gypsum, glass, etc and we can position them in every way we like. Because of the different materials, the "echo profile" we are effectively sculpting will have different amplitudes. So your h will end up being something like h=[1.0,0,0,0,0,0.6,0,0.1,0.05,0,0,0,0,0].

Does this actually happen in reality? Yes! Every time that you experience sound in a beautiful concert hall, someone has sat there for hours trying to sculpt the room's h so that its reflections don't give people a headache or you can actually hear what the speaker says. And you can see the sculpting tools all around you, there are bass traps, there are diffusers, there are simply panels hanging from the ceiling, there are curtains, each one of these corresponding to one or more coefficients in h. In fact, the h was starting to be sculpted since the architect specified the shape of the space.

Can we "get" the h of a room? Certainly, go to your living room, inflate a balloon and leave it somewhere close to your TV, put a microphone somewhere close to the couch and pinch the balloon so that it bursts. What happens? A sharp atmospheric disturbance (a unit pulse) travels through space, it hits the microphone but also bounces off walls and objects and hits the microphone later. There you have it, an h that when convolved with the "flat" signal from your TV would simulate what you actually hear in your living room. Now, repeat the same experiment in the bathroom (covered in tiles, different signature), or a long bunker in Scotland.

Different rooms, different h, different hearing experience. Different hearing experience at the long cobble-stone underpass, different hearing experience in the fabric shop.

It's a thunderstorm. You see the bolt (that's your first 1) and later on you hear rumble (subsequent echoes of the electric arc). That's the h that carries information about the landscape and the atmosphere around us as the atmospheric disturbance caused by the lightning arc travels in space and bounces. It takes the bursting of more than a balloon to see it though. You hit the note of a piano, the wave travels along the string, bounces of its end and comes back, it also travels through the wooden body of the piano and returns. Different material for the strings and the body, different h, different piano.

Tie a light bulb to a brick, throw it overboard and record it bursting at depth (from this site). That's the h of the ocean below the boat, it conveys information about how sound propagates.

What do all these phenomena have in common? Waves! Mechanical waves in fact, in the case of sound and the ways they interact. And actually, it's just a good enough approximation. There are many interesting non-linear phenomena (or this one) that take place in the sea and in the air and certainly in electronic circuits (reality, in general) that get lumped together in this simple model of interacting sinusoids and where this representation of reality would break.

Finally, please note that in the "modelling" reality, (from the mathematical point of view) the convolution integral is a a way of solving differential equations (models of systems) and has other applications too (please see the last three in this list).


1

An intuitive way to look a FIR filter is as a sort-of running match function. A weighted-sum-of-samples outputs how much the input looks similar to some "match" value inherent in the weights.

A bandpass filter looks sort of like a chunk of some waveform at the frequency that you want the filter to pass. A good match from a segment of about the same frequency of input signal outputs a high positive value. Shift that input 90 degrees, and the match is orthogonal, or nearly so, so the filter outputs a low value. Shift another 90 degrees, and the signal waveform now looks to be roughly the inverse of the FIR waveform, so the filter outputs a negative value. This alternation from positive to negative thus produces an output waveform that somewhat resembles the input waveform if it is a good match at some phase and an opposite match at other phases. Other input waveforms, such as DC, or a much higher frequency, won't match nearly as well, so will produce lower output values.

A moving average or low pass FIR filter has lots of weights the same or nearly the same, so will output at a higher level when the input does not oscillate both with positive and negative values around DC, which will cancel out, at least partially, when summed after nearly the same weighting.

Whereas a FIR filter kernel that alternates every weight, or nearly so, will cancel out given a DC input, but better match highest frequency inputs, and thus output more given input that looks less like DC, e.g. a high-pass filter.

Since FIR filtering in as LTI process, the "linear" in LTI means you can sum multiple "match types" together to create a linear combination of frequency responses, which is sort-of why the inverse FT of a frequency response produces a impulse response that can be used for FIR filtering with roughly that desired frequency response.

Some functions, such as sine and cosine, can be closely approximated by a short recursion. An IIR filter can be looked at as simply a combination of a short recursion function generator that generates some desired FIR filter-like "match" waveform, plus simultaneously doing the above match process at the same time.

Dengan menggunakan situs kami, Anda mengakui telah membaca dan memahami Kebijakan Cookie dan Kebijakan Privasi kami.
Licensed under cc by-sa 3.0 with attribution required.