Hpass filter & low pass filter



Low-pass filter

From Wikipedia, the free encyclopedia

A low-pass filter is a filter that passes low-frequency signals but attenuates (reduces the amplitude of) signals with frequencies higher than the cutoff frequency. The actual amount of attenuation for each frequency varies from filter to filter. It is sometimes called a high-cut filter, or treble cut filter when used in audio applications. A low-pass filter is the opposite of a high-pass filter, and a band-pass filter is a combination of a low-pass and a high-pass.

The concept of a low-pass filter exists in many different forms, including electronic circuits (like a hiss filter used in audio), digital algorithms for smoothing sets of data, acoustic barriers, blurring of images, and so on. Low-pass filters play the same role in signal processing that moving averages do in some other fields, such as finance; both tools provide a smoother form of a signal which removes the short-term oscillations, leaving only the long-term trend.

Contents

[hide]

[edit] Examples of low-pass filters

[edit] Acoustic

A stiff physical barrier tends to reflect higher sound frequencies, and so acts as a low-pass filter for transmitting sound. When music is playing in another room, the low notes are easily heard, while the high notes are attenuated.

[edit] Electronic

In an electronic low-pass RC filter for voltage signals, high frequencies contained in the input signal are attenuated but the filter has little attenuation below its cutoff frequency which is determined by its RC time constant.

For current signals, a similar circuit using a resistor and capacitor in parallel works in a similar manner. See current divider.discussed in more detail below. Signal Vout

Electronic low-pass filters are used to drive subwoofers and other types of loudspeakers, to block high pitches that they can't efficiently broadcast.

Radio transmitters use low-pass filters to block harmonic emissions which might cause interference with other communications.

The tone knob found on many electric guitars is a low-pass filter used to reduce the amount of treble in the sound.

An integrator is another example of a low-pass filter.

DSL splitters use low-pass and high-pass filters to separate DSL and POTS signals sharing the same pair of wires.

Low-pass filters also play a significant role in the sculpting of sound for electronic music as created by analogue synthesisers. See subtractive synthesis.

[edit] Ideal and real filters

The sinc function, the impulse response of an ideal low-pass filter.

An ideal low-pass filter completely eliminates all frequencies above the cutoff frequency while passing those below unchanged: its frequency response is a rectangular function, and is a brick-wall filter. The transition region present in practical filters does not exist in an ideal filter. An ideal low-pass filter can be realized mathematically (theoretically) by multiplying a signal by the rectangular function in the frequency domain or, equivalently, convolution with its impulse response, a sinc function, in the time domain.

However, the ideal filter is impossible to realize without also having signals of infinite extent, and so generally needs to be approximated for real ongoing signals, because the sinc function's support region extends to all past and future times. The filter would therefore need to have infinite delay, or knowledge of the infinite future and past, in order to perform the convolution. It is effectively realizable for pre-recorded digital signals by assuming extensions of zero into the past and future, or more typically by making the signal repetitive and using Fourier analysis.

Real filters for real-time applications approximate the ideal filter by truncating and windowing the infinite impulse response to make a finite impulse response; applying that filter requires delaying the signal for a moderate period of time, allowing the computation to "see" a little bit into the future. This delay is manifested as phase shift. Greater accuracy in approximation requires a longer delay.

An ideal low-pass filter results in ringing artifacts via the Gibbs phenomenon. These can be reduced or worsened by choice of windowing function, and the design and choice of real filters involves understanding and minimizing these artifacts. For example, "simple truncation [of sinc] causes severe ringing artifacts," in signal reconstruction, and to reduce these artifacts one uses window functions "which drop off more smoothly at the edges."[1]

The Whittaker–Shannon interpolation formula describes how to use a perfect low-pass filter to reconstruct a continuous signal from a sampled digital signal. Real digital-to-analog converters use real filter approximations.

[edit] Continuous-time low-pass filters

The gain-magnitude frequency response of a first-order (one-pole) low-pass filter. Power gain is shown in decibels (i.e., a 3 dB decline reflects an additional half-power attenuation). Angular frequency is shown on a logarithmic scale in units of radians per second.

There are a great many different types of filter circuits, with different responses to changing frequency. The frequency response of a filter is generally represented using a Bode plot, and the filter is characterized by its cutoff frequency and rate of frequency rolloff. In all cases, at the cutoff frequency, the filter attenuates the input power by half or 3 dB. So the order of the filter determines the amount of additional attenuation for frequencies higher than the cutoff frequency.

  • A first-order filter, for example, will reduce the signal amplitude by half (so power reduces by 6 dB) every time the frequency doubles (goes up one octave); more precisely, the power rolloff approaches 20 dB per decade in the limit of high frequency. The magnitude Bode plot for a first-order filter looks like a horizontal line below the cutoff frequency, and a diagonal line above the cutoff frequency. There is also a "knee curve" at the boundary between the two, which smoothly transitions between the two straight line regions. If the transfer function of a first-order low-pass filter has a zero as well as a pole, the Bode plot will flatten out again, at some maximum attenuation of high frequencies; such an effect is caused for example by a little bit of the input leaking around the one-pole filter; this one-pole–one-zero filter is still a first-order low-pass. See Pole–zero plot and RC circuit.
  • A second-order filter attenuates higher frequencies more steeply. The Bode plot for this type of filter resembles that of a first-order filter, except that it falls off more quickly. For example, a second-order Butterworth filter will reduce the signal amplitude to one fourth its original level every time the frequency doubles (so power decreases by 12 dB per octave, or 40 dB per decade). Other all-pole second-order filters may roll off at different rates initially depending on their Q factor, but approach the same final rate of 12 dB per octave; as with the first-order filters, zeroes in the transfer function can change the high-frequency asymptote. See RLC circuit.
  • Third- and higher-order filters are defined similarly. In general, the final rate of power rolloff for an order-n all-pole filter is 6n dB per octave (i.e., 20n dB per decade).

On any Butterworth filter, if one extends the horizontal line to the right and the diagonal line to the upper-left (the asymptotes of the function), they will intersect at exactly the "cutoff frequency". The frequency response at the cutoff frequency in a first-order filter is 3 dB below the horizontal line. The various types of filters – Butterworth filter, Chebyshev filter, Bessel filter, etc. – all have different-looking "knee curves". Many second-order filters are designed to have "peaking" or resonance, causing their frequency response at the cutoff frequency to be above the horizontal line. See electronic filter for other types.

The meanings of 'low' and 'high' – that is, the cutoff frequency – depend on the characteristics of the filter. The term "low-pass filter" merely refers to the shape of the filter's response; a high-pass filter could be built that cuts off at a lower frequency than any low-pass filter – it is their responses that set them apart. Electronic circuits can be devised for any desired frequency range, right up through microwave frequencies (above 1 GHz) and higher.

[edit] Laplace notation

Continuous-time filters can also be described in terms of the Laplace transform of their impulse response in a way that allows all of the characteristics of the filter to be easily analyzed by considering the pattern of poles and zeros of the Laplace transform in the complex plane (in discrete time, one can similarly consider the Z-transform of the impulse response).

For example, a first-order low-pass filter can be described in Laplace notation as


\frac{\text{Output}}{\text{Input}} = K \frac{1}{1 + s \tau}

where s is the Laplace transform variable, τ is the filter time constant, and K is the filter passband gain.

[edit] Electronic low-pass filters

[edit] Passive electronic realization

Passive, first order low-pass RC filter

One simple electrical circuit that will serve as a low-pass filter consists of a resistor in series with a load, and a capacitor in parallel with the load. The capacitor exhibits reactance, and blocks low-frequency signals, causing them to go through the load instead. At higher frequencies the reactance drops, and the capacitor effectively functions as a short circuit. The combination of resistance and capacitance gives you the time constant of the filter τ = RC (represented by the Greek letter tau). The break frequency, also called the turnover frequency or cutoff frequency (in hertz), is determined by the time constant:


f_\mathrm{c} = {1 \over 2 \pi \tau } = {1 \over 2 \pi R C}

or equivalently (in radians per second):


\omega_\mathrm{c} = {1 \over \tau} = { 1 \over R C}.

One way to understand this circuit is to focus on the time the capacitor takes to charge. It takes time to charge or discharge the capacitor through that resistor:

  • At low frequencies, there is plenty of time for the capacitor to charge up to practically the same voltage as the input voltage.
  • At high frequencies, the capacitor only has time to charge up a small amount before the input switches direction. The output goes up and down only a small fraction of the amount the input goes up and down. At double the frequency, there's only time for it to charge up half the amount.

Another way to understand this circuit is with the idea of reactance at a particular frequency:

  • Since DC cannot flow through the capacitor, DC input must "flow out" the path marked Vout (analogous to removing the capacitor).
  • Since AC flows very well through the capacitor — almost as well as it flows through solid wire — AC input "flows out" through the capacitor, effectively short circuiting to ground (analogous to replacing the capacitor with just a wire).

It should be noted that the capacitor is not an "on/off" object (like the block or pass fluidic explanation above). The capacitor will variably act between these two extremes. It is the Bode plot and frequency response that show this variability.

[edit] Active electronic realization

An active low-pass filter

Another type of electrical circuit is an active low-pass filter.

In the operational amplifier circuit shown in the figure, the cutoff frequency (in hertz) is defined as:


f_{\text{c}} = \frac{1}{2 \pi R_2 C}

or equivalently (in radians per second):


\omega_{\text{c}} = \frac{1}{R_2 C}

The gain in the passband is \frac{-R_2}{R_1}, and the stopband drops off at −6 dB per octave as it is a first-order filter.

Sometimes, a simple gain amplifier (as opposed to the very-high-gain operation amplifier) is turned into a low-pass filter by simply adding a feedback capacitor C. This feedback decreases the frequency response at high frequencies via the Miller effect, and helps to avoid oscillation in the amplifier. For example, an audio amplifier can be made into a low-pass filter with cutoff frequency 100 kHz to reduce gain at frequencies which would otherwise oscillate. Since the audio band (what we can hear) only goes up to 20 kHz or so, the frequencies of interest fall entirely in the passband, and the amplifier behaves the same way as far as audio is concerned.

[edit] Discrete-time realization

The effect of a low-pass filter can be simulated on a computer by analyzing its behavior in the time domain, and then discretizing the model.

A simple low-pass RC filter

From the circuit diagram to the right, according to Kirchoff's Laws and the definition of capacitance:

\begin{cases}
v_{\text{in}}(t) - v_{\text{out}}(t) = R \, i(t)&\text{(V)}\\
Q_c(t) = C \, v_{\text{out}}(t)&\text{(Q)}\\
i(t) = \frac{\operatorname{d} Q_c}{\operatorname{d} t} &\text{(I)}
\end{cases}

where Qc(t) is the charge stored in the capacitor at time t. Substituting Equation (Q) into Equation (I) gives i(t) = C \frac{\operatorname{d}v_{\text{out}}}{\operatorname{d}t}, which can be substituted into Equation (V) so that:

v_{\text{in}}(t) - v_{\text{out}}(t) = RC \frac{\operatorname{d}v_{\text{out}}}{\operatorname{d}t}\,

This equation can be discretized. For simplicity, assume that samples of the input and output are taken at evenly-spaced points in time separated by ΔT time. Let the samples of vin be represented by the sequence (x_1, x_2, \ldots, x_n), and let vout be represented by the sequence (y_1, y_2, \ldots, y_n) which correspond to the same points in time. Making these substitutions:

x_i - y_i = RC \, \frac{y_{i}-y_{i-1}}{\Delta_T}\,

And rearranging terms gives the recurrence relation

y_i = \overbrace{x_i \left( \frac{\Delta_T}{RC + \Delta_T} \right)}^{\text{Input contribution}} + \overbrace{y_{i-1} \left( \frac{RC}{RC + \Delta_T} \right)}^{\text{Inertia from previous output}}

That is, this discrete-time implementation of a simple RC low-pass filter is the exponentially-weighted moving average

y_i = \alpha x_i + (1 - \alpha) y_{i-1} \qquad \text{where} \qquad \alpha \triangleq \frac{\Delta_T}{RC + \Delta_T}\,

By definition, the smoothing factor 0 \leq \alpha \leq 1. The expression for α yields the equivalent time constant RC in terms of the sampling period ΔT and smoothing factor α:

RC = \Delta_T \left( \frac{1 - \alpha}{\alpha} \right)

If α = 0.5, then the RC time constant equal to the sampling period. If \alpha \ll 0.5, then RC is significantly larger than the sampling interval, and \Delta_T \approx \alpha RC.

[edit] Algorithmic implementation

The filter recurrence relation provides a way to determine the output samples in terms of the input samples and the preceding output. The following pseudocode algorithm will simulate the effect of a low-pass filter on a series of digital samples:

 // Return RC low-pass filter output samples, given input samples, // time interval dt, and time constant RC function lowpass(real[0..n] x, real dt, real RC)   var real[0..n] y   var real α := dt / (RC + dt)   y[0] := x[0]   for i from 1 to n       y[i] := α * x[i] + (1-α) * y[i-1]       return y

The loop which calculates each of the n outputs can be refactored into the equivalent:

   for i from 1 to n       y[i] := y[i-1] + α * (x[i] - y[i-1])

That is, the change from one filter output to the next is proportional to the difference between the previous output and the next input. This exponential smoothing property matches the exponential decay seen in the continuous-time system. As expected, as the time constant RC increases, the discrete-time smoothing parameter α decreases, and the output samples (y_1,y_2,\ldots,y_n) respond more slowly to a change in the input samples (x_1,x_2,\ldots,x_n) – the system will have more inertia.


High-pass filter

From Wikipedia, the free encyclopedia

Jump to: navigation, search

A high-pass filter is an LTI filter that passes high frequencies well but attenuates (i.e., reduces the amplitude of) frequencies lower than the cutoff frequency. The actual amount of attenuation for each frequency is a design parameter of the filter. It is sometimes called a low-cut filter; the terms bass-cut filter or rumble filter are also used in audio applications.[citation needed]

Contents

[hide]

[edit] First-order continuous-time implementation

Figure 1: A passive, analog, first-order high-pass filter, realized by an RC circuit

The simple first-order electronic high-pass filter shown in Figure 1 is implemented by placing an input voltage across the series combination of a capacitor and a resistor and using the voltage across the resistor as an output. The product of the resistance and capacitance (R×C) is the time constant (τ); it is inversely proportional to the cutoff frequency fc, at which the output power is half the input power. That is,

f_c = \frac{1}{2 \pi \tau} = \frac{1}{2 \pi R C},\,

where fc is in hertz, τ is in seconds, R is in ohms, and C is in farads.

Figure 2: An active high-pass filter

Figure 2 shows an active electronic implementation of a first-order high-pass filter using an operational amplifier. In this case, the filter has a passband gain of -R2/R1 and has a corner frequency of

f_c = \frac{1}{2 \pi \tau} = \frac{1}{2 \pi R_1 C},\,

Because this filter is active, it may have non-unity passband gain. That is, high-frequency signals are inverted and amplified by R2/R1.

[edit] Discrete-time realization

Discrete-time high-pass filters can also be designed. Discrete-time filter design is beyond the scope of this article; however, a simple example comes from the conversion of the continuous-time high-pass filter above to a discrete-time realization. That is, the continuous-time behavior can be discretized.

From the circuit in Figure 1 above, according to Kirchoff's Laws and the definition of capacitance:

\begin{cases}
V_{\text{out}}(t) = I(t)\, R &\text{(V)}\\
Q_c(t) = C \, \left( V_{\text{in}}(t) - V_{\text{out}}(t) \right) &\text{(Q)}\\
I(t) = \frac{\operatorname{d} Q_c}{\operatorname{d} t} &\text{(I)}
\end{cases}

where Qc(t) is the charge stored in the capacitor at time t. Substituting Equation (Q) into Equation (I) and then Equation (I) into Equation (V) gives:

V_{\text{out}}(t) = \overbrace{C \, \left( \frac{\operatorname{d} V_{\text{in}}}{\operatorname{d}t} - \frac{\operatorname{d} V_{\text{out}}}{\operatorname{d}t} \right)}^{I(t)} \, R = R C \, \left( \frac{ \operatorname{d} V_{\text{in}}}{\operatorname{d}t} - \frac{\operatorname{d} V_{\text{out}}}{\operatorname{d}t} \right)

This equation can be discretized. For simplicity, assume that samples of the input and output are taken at evenly-spaced points in time separated by ΔT time. Let the samples of Vin be represented by the sequence (x_1, x_2, \ldots, x_n), and let Vout be represented by the sequence (y_1, y_2, \ldots, y_n) which correspond to the same points in time. Making these substitutions:

y_i = R C \, \left( \frac{x_i - x_{i-1}}{\Delta_T} - \frac{y_i - y_{i-1}}{\Delta_T} \right)

And rearranging terms gives the recurrence relation

y_i = \overbrace{\frac{RC}{RC + \Delta_T} y_{i-1}}^{\text{Decaying contribution from prior inputs}} + \overbrace{\frac{RC}{RC + \Delta_T} \left( x_i -  x_{i-1} \right)}^{\text{Contribution from change in input}}

That is, this discrete-time implementation of a simple continuous-time RC high-pass filter is

y_i = \alpha y_{i-1} + \alpha (x_{i} - x_{i-1}) \qquad \text{where} \qquad \alpha \triangleq \frac{RC}{RC + \Delta_T}

By definition, 0 \leq \alpha \leq 1. The expression for parameter α yields the equivalent time constant RC in terms of the sampling period ΔT and α:

RC = \Delta_T \left( \frac{\alpha}{1 - \alpha} \right)

If α = 0.5, then the RC time constant equal to the sampling period. If \alpha \ll 0.5, then RC is significantly smaller than the sampling interval, and RC \approx \alpha \Delta_T.

[edit] Algorithmic implementation

The filter recurrence relation provides a way to determine the output samples in terms of the input samples and the preceding output. The following pseudocode algorithm will simulate the effect of a high-pass filter on a series of digital samples:

 // Return RC high-pass filter output samples, given input samples, // time interval dt, and time constant RC function highpass(real[0..n] x, real dt, real RC)   var real[0..n] y   var real α := RC / (RC + dt)   y[0] := x[0]   for i from 1 to n     y[i] := α * y[i-1] + α * (x[i] - x[i-1])   return y

The loop which calculates each of the n outputs can be refactored into the equivalent:

   for i from 1 to n     y[i] := α * (y[i-1] + x[i] - x[i-1])

However, the earlier form shows how the parameter α changes the impact of the prior output y[i-1] and current change in input (x[i] - x[i-1]). In particular,

  • A large α implies that the output will decay very slowly but will also be strongly influenced by even small changes in input. By the relationship between parameter α and time constant RC above, a large α corresponds to a large RC and therefore a low corner frequency of the filter. Hence, this case corresponds to a high-pass filter with a very narrow stop band. Because it is excited by small changes and tends to hold its prior output values for a long time, it can pass relatively low frequencies. However, a constant input (i.e., an input with (x[i] - x[i-1])=0) will always decay to zero, as would be expected with a high-pass filter with a large RC.
  • A small α implies that the output will decay quickly and will require large changes in the input (i.e., (x[i] - x[i-1]) is large) to cause the output to change much. By the relationship between parameter α and time constant RC above, a small α corresponds to a small RC and therefore a high corner frequency of the filter. Hence, this case corresponds to a high-pass filter with a very wide stop band. Because it requires large (i.e., fast) changes and tends to quickly forget its prior output values, it can only pass relatively high frequencies, as would be expected with a high-pass filter with a small RC.

[edit] Applications

Such a filter could be used as part of an audio crossover to direct high frequencies to a tweeter while blocking bass signals which could interfere with, or damage, the speaker. When such a filter is built into a loudspeaker cabinet it is normally a passive filter that also includes a low-pass filter for the woofer and so often employs both a capacitor and inductor (although very simple high-pass filters for tweeters can consist of a series capacitor and nothing else). An alternative, which provides good quality sound without inductors (which are prone to parasitic coupling, are expensive, and may have significant internal resistance) is to employ bi-amplification with active RC filters with separate power amplifiers for each loudspeaker making an active crossover.[citation needed]

Rumble filters are high-pass filters applied to the removal of unwanted sounds below or near to the lower end of the audible range. For example, noises (e.g., footsteps, or motor noises from record players and tape decks) may be removed because they are undesired or may overload the RIAA equalization circuit of the preamp.[citation needed]

High-pass and low-pass filters are also used in digital image processing to perform transformations in the spatial frequency domain.[citation needed]

High-pass filters are also used for AC coupling at the input and output of amplifiers.[citation needed]