From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

RF Simulation Demo: Filters - LPF and HPF

Code and Documents

Attachment

Theory

A filter is an often a frequency selective circuit that passes a specified band of frequencies and blocks or attenuates signals of frequencies outside this band. Filter may be classified in a number of ways:

  • Analog filter
  • Passive filter
  • Audio filter

Analog filters are designed to process analog signals, while digital filters process analog signals using digital techniques.  Depending on the type of elements used in their construction, filters may be classified as passive or active.  Elements used in passive filters are resistors, capacitors, and inductors. Active filters on the other hand, employ transistors or op amps in addition to the resistors and capacitors.  The type of element used dictates the operating frequency range of the filter.  For example, RC filters are commonly used for audio or low frequency operation, whereas LC or crystal filters are employed at RF or high frequencies.  Especially because of their high Q value, the crystals provide more stable operation at higher frequencies.  An active filter offers the following advantages over a passive filter:

  • Gain and frequency adjustment flexibility
  • No loading problem
  • Cost

Although active filters are most extensively used in the field of communications and signal processing, they are employed in one form or another in almost all sophisticated electronic systems.  Radio, television, telephone, radar, space satellites, and biomedical equipment are but a few systems that employ active filters.  The most commonly used filters are these:

  • Low pass filter - allows low frequencies to pass and attenuates high frequencies
  • High pass filter - allows high frequencies to pass and attenuates low frequencies
  • Band pass filter - allows a range of frequencies to pass
  • Band stop filter - attenuates a range of frequencies and allows all frequencies not within the range to pass

Demonstration

1) Place the Simulate Signal VI in the block diagram and provide a control for frequency variation in the front panel

2) Place a Filter Express VI in the block diagram and configure it as LPF with the frequency of 1500Hz

3) Place the Filter Express VI in the block diagram and configure it as HPF with the frequency of 3000Hz

4) Place the Merge Signal function in the block diagram in order to merge the two filtered output signals

5) Place the FFT function VI in the block diagram to measure the FFT results in linear and log

6) Place the Tone Measurement VI in the block diagram in order to measure the single tone results

7) Place the waveform graphs in the front panel and wire the blocks to each output function in the block diagram

😎 Place the sub diagrams inside the while loop in order to repeat the operation until the stop button is enabled


Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Contributors