For many IoT sensor measurement applications, an IIR or FIR filter is just one of the many components needed for an algorithm. This could be a powerline interference canceller for a biomedical application or even a simpler DC loadcell filter. In many cases, it is necessary to integrate a filter into a complete algorithm in another domain.

Matlab is a well-established numerical computing language developed by the Mathworks that allows for the design of algorithms, matrix data manipulations and data analysis. The product offers a broad range of algorithms and support functions for signal processing applications, and as such is very popular amongst many scientists and engineers worldwide.

ASN Filter Designer automatic code generator for Matlab

The ASN Filter Designer greatly simplifies exporting a designed filter to Matlab via its automatic code generator. The code generator supports all aspects of the ASN Filter Designer, allowing for a complete design comprised of H1, H2 and H3 filters and math operators to be fully integrated with an algorithm in Matlab.

The Matlab code generator can be accessed via the filter summary options (as shown on the right). Selecting this option will automatically generate a Matlab .m file based on the current design.

A convenient shortcut to the relevant Framework files and examples is available in the Filter summary toolbar via the folder symbol (see left).

Using the three framework files, you may build a demo of your choice based on the exported filter(s) specifications. The framework supports both Real and Complex filters in floating point only. In order to use the generated code in Matlab without the need for Signal Processing Toolbox, the following three framework files are provided in the ASN Filter Designer’s \Matlab directory:


These framework files do not have any special Matlab toolbox dependences, and the example script ASNFDMatlabDemo.m demonstrates the simplicity with which the framework can be integrated into your application for your designed filter. Several example filters generated via the automatic code generator are given within ASNFDMatlabDemo.m in order to get you going!

Comparing the results to Matlab’s Signal Processing Toolbox

It’s sometimes informative to compare the results of the ASN Filter Designer’s DSP library functions to that of Matlab’s Signal Processing Toolbox.

Designing an IIR Chebyshev Type I filter with the following specifications:

Passband frequency:0-25Hz
Method:Chebyshev Type I
Stopband attenuation @ 125Hz:≥ 80 dB
Passband ripple:≤ 0.1dB

Graphically entering the specifications into the ASN Filter Designer, and fine tuning the design marker positions, the tool automatically designs the filter as a Biquad cascade. Notice that the tool automatically finds the required filter order, and in essence – automatically produces the filter’s exact technical specification!

The frequency response of a 5th order IIR Chebyshev Type I lowpass filter meeting the specifications is shown below:

The resulting filter coefficients are:

Designing the same filter in Matlab using Signal Processing Toolbox:


[z, p, k] = cheby1(N,Rp,Wn,'low'); % design lowpass

[sos,g]=zp2sos(z,p,k,'up')  % generate SOS form

Running the script, we get the following, where each row of sos is a biquad arranged as: b0 b1 b2 a0 a1 a2

Analysing both sets of numerator and denominator coefficients, we get exactly the same result! But what about the gain? Matlab outputs a net gain, g = 3.0096e-05 but the ASN Filter Designer optimally assigns a gain to each biquad. Thus, combining the biquad section gains, i.e. 0.078643, 0.013823 and 0.027685 results in a net gain of 3.0096e-05, which is exactly the same net gain as Matlab!

Conclusion: the ASN Filter Designer’s DSP IIR library functions completely match Matlab’s Signal Processing Toolbox results!!

The complete automatically generated code is shown below, where it can be seen that the biquad gains have been pre-multiplied with the feedforward coefficients.

Using the generated code with Signal Processing Toolbox

If you have Signal Processing Toolbox installed, then you may directly use the generated coefficients given in SOS with the sosfilt() command, e.g.

Clear all;

ASNFD_SOS=[ 0.07864301814, 0.07864301814, 0.00000000000, 1.00000000000,-0.84271396371, 0.00000000000;...
 0.01382289248, 0.02764578495, 0.01382289248, 1.00000000000,-1.70536517618, 0.76065674608;...
 0.02768538360, 0.05537076720, 0.02768538360, 1.00000000000,-1.79181447713, 0.90255601154;...
y=sosfilt(ASNFD_SOS, x); %  x is your input data

plot(x,y); % plot results

As seen, it is as simple as copying and pasting the filter coefficients from the ASN Filter Designer’s filter summary into a Matlab script.



Download demo now


Licencing information


Did you know that there are 23 billion IoT embedded devices currently deployed around the world? This figure is expected to grow to a whopping 1 trillion devices by 2050!

Less known, is that 80% of IoT devices are based around Arm’s Cortex-M microcontroller technology. Sometimes clients ask us if we support their Arm Cortex-M based demo-board of choice. The answer is simply: yes!

200+ IC vendors supported

The ASN Filter Designer has an automatic code generator for Arm Cortex-M cores, which means that we support virtually every Arm based demo-board: ST, Cypress, NXP, Analog Devices, TI, Microchip/Atmel and over 200+ other manufacturers. Our compatibility with Arm’s free CMSIS-DSP software framework removes the frustration of implementing complicated digital filters in your IoT application – leaving you with code that is optimal for Cortex-M devices and that works 100% of the time.

The Arm Cortex-M family of microcontrollers are an excellent match for IoT applications. Some of the advantages include:

  • Low power and cost – essential for IoT devices
  • Microcontroller with DSP functionality all-in-one
  • Embedded hardware security functionality
  • Cortex-M4 and M7 cores with hardware floating support (enhanced microcontrollers)
  • Freely available CMSIS-DSP C library: supporting over 60 signal processing functions

Automatic code generation for Arm’s CMSIS-DSP software framework

Simply load your sensor data into the ASN Filter Designer signal analyser and perform a detailed analysis. After identifying the wanted and unwanted components of your signal, design a filter and test the performance in real-time on your test data. Export the designed design to Arm MDK, C/C++ or integrate the filter into your algorithm in another domain, such as in Matlab, Python, Scilab or Labview.

Use the tool in your RAD (rapid application development) process, by taking advantage of the automatic code generation to Arm’s CMSIS-DSP software framework, and quickly integrate the DSP filter code into your main application code.

Let the tool analyse your design, and automatically generate fully compliant code for either the M0, M0+, M3, M4 and the newer M23 and M33 Cortex cores. Deploy your design within minutes rather than hours.

Proud Arm knowledge partner

We are proud that we are an Arm knowledge partner! As an Arm DSP knowledge partner, we will be kept informed of their product roadmap and progress for the coming years.

Try it for yourself and see the benefits that the ASN Filter Designer can offer your organisation by cutting your development costs by up to 75%!



Download demo now


Licencing information