How programing LowPass Filter - GitMasterNikanjam/C_WiKi GitHub Wiki
A low-pass filter is an electronic circuit or a digital signal processing technique that allows signals with a frequency lower than a certain cutoff frequency to pass through while attenuating or blocking higher-frequency signals. In other words, it allows low-frequency components to pass while attenuating high-frequency components.
The basic idea behind a low-pass filter is to smooth or eliminate high-frequency noise from a signal, allowing the desired low-frequency components to be preserved. This is commonly used in various applications, such as audio processing, communication systems, and control systems.
There are different types of low-pass filters, including analog filters and digital filters. Analog low-pass filters are implemented using passive components like resistors, capacitors, and inductors. These filters can be categorized into various designs, such as RC (resistor-capacitor) filters, RL (resistor-inductor) filters, and RLC (resistor-inductor-capacitor) filters.
Digital low-pass filters, on the other hand, are implemented using algorithms in digital signal processing (DSP). They are commonly used in applications where signals are processed digitally, such as audio processing in digital audio systems, image processing, and communication systems.
The key parameter in a low-pass filter is the cutoff frequency. This is the frequency beyond which the filter starts attenuating the signal. The rate at which the filter attenuates the higher frequencies is determined by the filter's slope, often specified in decibels per octave.
Low-pass filters find applications in various areas, including audio systems to remove high-frequency noise, in communications to limit the bandwidth of signals, and in control systems to filter out high-frequency disturbances.
It's important to note that while low-pass filters are designed to allow low-frequency signals to pass through, they inherently introduce some phase shift and distortion to the signal, especially near the cutoff frequency. The choice of filter type and design parameters depends on the specific requirements of the application.
Equations
Continuous
To configure the filter for continuous time, set the Sample time property to 0. This representation is equivalent to the continuous transfer function:
G(s)= K/(Ts+1)
where:
-
K is the filter gain.
-
T is the filter time constant.
From the preceding transfer function, the filter defining equations are:
where:
-
u is filter input.
-
x is filter state.
-
y is filter output.
-
t is simulation time.
u0 is the initial input to the block.
Discrete
To configure the filter for discrete time, set the Sample time property to a positive, nonzero value, or to -1 to inherit the sample time from an upstream block. The discrete representation is equivalent to the transfer function:
where:
-
K is the filter gain.
-
T is the filter time constant.
-
Ts is the filter sample time.
From the discrete transfer function, the filter equations are defined using the forward Euler method:
where:
-
u is the filter input.
-
x is the filter state.
-
y is the filter output.
-
n is the simulation time step.
-
u0 is the initial input to the block.
Electronic low-pass filters
One simple low-pass filter [circuit] 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, forcing them 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 the [time constant] of the filter T
The break frequency, also called the turnover frequency, corner frequency, or [cutoff frequency] (in hertz), is determined by the time constant: