LabVIEW MathScript RT Module

cancel
Showing results for 
Search instead for 
Did you mean: 

MathScript Nugget #14: Digital Filter Design in MathScript

In the previous MathScript Nugget, I discussed how the LabVIEW Control Design and Simulation Module installs many functions and datatypes in MathScript. This week, we’ll look at another product that gives you additional MathScript functions: the Digital Filter Design Toolkit.

This toolkit does exactly what you might think it would given its name: help you design digital filters. The MathScript functions allow you to create both single-rate filters (FIR and IIR) and multirate filters (such as Nyquist and halfband filters). While the DFD Toolkit doesn’t provide as many functions or datatypes as Control Design does, they are still extremely useful.

The best way to learn what a function does in MathScript is to try out the code snippet that’s included with its documentation. For example, the help for the fir_linfconstr function contains four example snippets. Here’s one of them:

 

B = fir_linfconstr(12, [0, 0.4, 0.5, 1], [1, 1, 0, 0], [1, 1], 'ww', 'minphase');
fft_mag = abs(fft(B, 16384));
figure;
plot(0:1/8192:1, fft_mag(1:8193));
figure;
zplane(B, 1);

 

If you run this, MathScript will create some plots that will look familiar to anyone with a background in digital filters:

 

 

lowpass.png zeros.png

 


In this case, the plots generated by this snippet show the filter response and zeros of a low-pass filter created by the function. I encourage you to play around with all of the MathScript functions offered by the Digital Filter Design Toolkit to see what they can do!

jattas
LabVIEW MathScript R&D

 

ps Check out more MathScript Nuggets!

0 Kudos
Message 1 of 2
(8,239 Views)

"designfilt" command not working in Mathscript window. how to fix this?

0 Kudos
Message 2 of 2
(3,666 Views)