<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BZT &#8211; ASN Home</title>
	<atom:link href="https://www.advsolned.com/tag/bzt/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.advsolned.com</link>
	<description>ASN home site</description>
	<lastBuildDate>Tue, 07 Jan 2025 15:58:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Deploying legacy analog filters to Arm Cortex-M processor cores</title>
		<link>https://www.advsolned.com/deploying-legacy-analog-filters-to-arm-cortex-m-processors/</link>
					<comments>https://www.advsolned.com/deploying-legacy-analog-filters-to-arm-cortex-m-processors/#respond</comments>
		
		<dc:creator><![CDATA[Dr. Sanjeev Sarpal]]></dc:creator>
		<pubDate>Fri, 14 Sep 2018 12:51:34 +0000</pubDate>
				<category><![CDATA[ASN FilterScript]]></category>
		<category><![CDATA[analog filter]]></category>
		<category><![CDATA[BZT]]></category>
		<category><![CDATA[CMSIS-DSP]]></category>
		<category><![CDATA[Cortex-M]]></category>
		<category><![CDATA[IoT]]></category>
		<category><![CDATA[legacy]]></category>
		<category><![CDATA[modeling]]></category>
		<guid isPermaLink="false">http://www.advsolned.com/?p=7792</guid>

					<description><![CDATA[<p>The ASN Filter Designer’s Arm automatic code generator automatically generates Arm CMSIS-DSP compliant C code suitable for direct implementation Cortex-M</p>
<p>The post <a rel="nofollow" href="https://www.advsolned.com/deploying-legacy-analog-filters-to-arm-cortex-m-processors/">Deploying legacy analog filters to Arm Cortex-M processor cores</a> appeared first on <a rel="nofollow" href="https://www.advsolned.com">ASN Home</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In recent years, major microcontroller IC vendors such as: ST, NXP, TI, ADI, Atmel/Microchip, Cypress, Maxim to name but a few have based their modern 32-bit microcontrollers on Arm’s Cortex-M processor cores. This exciting trend means that algorithms traditionally undertaken in expensive DSPs (digital signal processors) can now be integrated into a powerful low-cost and power efficient microcontroller packed full of a rich assortment of connectivity and peripheral options, which is ideal for many IoT applications.</p>



<p>For many IC vendors, the coupling of DSP functionality with the flexibility of a low power microcontroller, has allowed them to offer their customers a generation of so called <strong>32-bit enhanced microcontrollers</strong> suitable for a variety of practical applications. More importantly, this marriage of technologies has also allowed designers working on price critical IoT applications to implement complex algorithmic concepts, while at the same time keeping the overall product cost low and still achieving excellent low power performance.</p>



<h2 class="wp-block-heading">Upgrading legacy analog filters with the ASN Filter Designer</h2>



<p>Analog filters have been around since the beginning of electronics, ranging from simple inductor-capacitor networks to more advanced active filters with op-amps. As such, there is a rich collection of tried and tested legacy filter designs for a broad range of sensor measurement applications.</p>



<p>ASN’s FilterScript symbolic math scripting language offers designers the ability to take an existing analog filter transfer function and transform it to digital with just a few lines of code. The ASN Filter Designer’s Arm automatic code generator analyses the designed digital filter and then<strong> automatically generates Arm CMSIS-DSP compliant C code</strong> suitable for direct implementation on a Cortex-M based microcontroller.</p>



<h3 class="wp-block-heading"><strong>Arm CMSIS-DSP software framework</strong></h3>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-1 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.7%">
<p>The <a style="color: #0000ff;" href="https://arm-software.github.io/CMSIS_5/DSP/html/index.html">Arm CMSIS-DSP</a> (Cortex Microcontroller Software Interface Standard)&nbsp; software framework is a rich collection of over sixty DSP functions (including various mathematical functions, such as sine and cosine; IIR/FIR filtering functions, complex math functions, and data types) developed by Arm that have been optimised for their range of Cortex-M processor cores. </p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:30%"><div class="wp-block-image is-resized">
<figure class="alignright size-large"><img decoding="async" src="https://www.advsolned.com/wp-content/uploads/2018/02/cmsis.png" alt=""/></figure></div></div>
</div>



<p>The framework makes extensive use of highly optimised SIMD (single instruction, multiple data) instructions, that perform multiple identical operations in a single cycle instruction. The SIMD instructions (if supported by the core) coupled together with other optimisations allow engineers to produce highly optimised signal processing applications for Cortex-M based micro-controllers quickly and simply.</p>



<h2 class="wp-block-heading">Mathematically modelling an analog circuit</h2>


<div class="wp-block-image">
<figure class="aligncenter size-large"><a href="http://www.advsolned.com/wp-content/uploads/2018/09/preempcircuit.png"><img fetchpriority="high" decoding="async" width="796" height="397" src="https://www.advsolned.com/wp-content/uploads/2020/04/preempcircuit.png" alt="" class="wp-image-12246" srcset="https://www.advsolned.com/wp-content/uploads/2020/04/preempcircuit.png 796w, https://www.advsolned.com/wp-content/uploads/2020/04/preempcircuit-300x150.png 300w, https://www.advsolned.com/wp-content/uploads/2020/04/preempcircuit-768x383.png 768w, https://www.advsolned.com/wp-content/uploads/2020/04/preempcircuit-705x352.png 705w, https://www.advsolned.com/wp-content/uploads/2020/04/preempcircuit-450x224.png 450w" sizes="(max-width: 796px) 100vw, 796px" /></a></figure></div>


<p>Consider the active pre-emphasis filter shown below. The pre-emphasis filter has found particular use in audio work, since it is necessary to amplify the higher frequencies of the speech spectrum, whilst leaving the lower frequencies unaffected. The R and C values shown are only indented for the example, more practical values will depend on the application. A powerful method of reproducing the magnitude and phases characteristics of the analog filter in a digital implementation, is to mathematically model the circuit. This circuit may be analysed using Kirchhoff’s law, since the sum of currents into the op-amp’s inverting input <strong>must be equal to zero for negative feedback to work correctly</strong> – this results in a transfer function with a negative gain.</p>



<p>Therefore, using Ohm&#8217;s law, i.e. \(I=\frac{V}{R}\),</p>


\(<br />
\displaystyle\frac{X(s)}{R_3}=-\frac{U(s)}{C_1||R_2 + R_1}<br />
\)



<p>After some algebraic manipulation, it can be seen that an expression for the circuit&#8217;s closed loop gain may be expressed as,</p>


\(<br />
\displaystyle\frac{X(s)}{U(s)}=-\frac{R_3}{R_1}\frac{\left(s+\frac{1}{R_2C_1}\right)}{\left(s+\frac{R_1+R_2}{R_1R_2C_1}\right)}<br />
\)



<p>substituting the values shown in the circuit diagram into the developed transfer function, yields</p>


\(<br />
\displaystyle H(s)=-10\left(\frac{s+1000}{s+11000}\right)<br />
\)



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<div style="height:20px" aria-hidden="true" class="wp-block-spacer"></div>



<h3 class="wp-block-heading"><strong>What sampling rate do we need?<span class="" style="display:block;clear:both;height: 0px;padding-top: 10px;border-top-width:0px;border-bottom-width:0px;"></span></strong><br></h3>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-2 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:20%">
<figure class="wp-block-image size-large"><img decoding="async" width="220" height="233" src="https://www.advsolned.com/wp-content/uploads/2020/04/SRpremp.png" alt="" class="wp-image-12249"/></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<p>Analysing the cut-off frequencies in \(H(s)\), we see that the upper frequency is at \(11000 rad/sec\) or \(1.75kHz\). Therefore, setting the sampling rate to \(16kHz\) should be adequate for modelling the filter in the digital domain.</p>



<p>The sampling rate options are avaliabe in the main filter design UI&nbsp; (shown on the left).</p>



<p></p>
</div>
</div>



<h3 class="wp-block-heading"><strong>ASN FilterScript</strong></h3>



<p>\(H(s)\) can be easily specified in FilterScript with the <code>analogtf</code> function, as follows:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: java; gutter: false; title: ; notranslate">
Nb={1,1000};
Na={1,11000};

Ha=analogtf(Nb,Na,-10,"symbolic");
</pre></div>


<p>Notice how the negative gain may also be entered directly into function’s argument. The <code>symbolic</code> keyword generates a symbolic transfer function representation in the command window.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><a href="http://www.advsolned.com/wp-content/uploads/2018/09/analogpremp.png"><img decoding="async" width="391" height="88" src="https://www.advsolned.com/wp-content/uploads/2020/04/analogpremp.png" alt="" class="wp-image-12250" srcset="https://www.advsolned.com/wp-content/uploads/2020/04/analogpremp.png 391w, https://www.advsolned.com/wp-content/uploads/2020/04/analogpremp-300x68.png 300w" sizes="(max-width: 391px) 100vw, 391px" /></a></figure></div>


<p>Applying the Bilinear z-transformation via the <code>bilinear</code> command with no pre-warping, i.e.</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: java; gutter: false; title: ; notranslate">
Hd=bilinear(Ha,0,"symbolic");
</pre></div>

<div class="wp-block-image">
<figure class="aligncenter size-large"><a href="http://www.advsolned.com/wp-content/uploads/2018/09/bztpremp.png"><img loading="lazy" decoding="async" width="402" height="99" src="https://www.advsolned.com/wp-content/uploads/2020/04/bztpremp.png" alt="" class="wp-image-12253" srcset="https://www.advsolned.com/wp-content/uploads/2020/04/bztpremp.png 402w, https://www.advsolned.com/wp-content/uploads/2020/04/bztpremp-300x74.png 300w" sizes="auto, (max-width: 402px) 100vw, 402px" /></a></figure></div>


<p><br>Notice how the <code>bilinear</code> command automatically scales numerator coefficients by -1, in order to account for the effect of the negative gain. The command also automatically assigns the analog filter to the reference spectrum object, which can be shown via the <code>ShowH2DM</code> keyword. The complete code is shown below:</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: java; title: ; notranslate">
ClearH1;    // remove other filters from the cascade
ShowH2DM;   // show the analog reference spectrum 

Main()

Nb={1,1000};
Na={1,11000};

Ha=analogtf(Nb,Na,-10,"symbolic");
Hd=bilinear(Ha,0,"symbolic");

Num=getnum(Hd);
Den=getden(Hd);
Gain=getgain(Hd);
</pre></div>


<p>A comparison of the analog (shown in red) and discrete (shown in blue) magnitude spectra is shown below. Analysing the spectra, it can be seen that for a sampling rate of 16kHz the analog and digital filters are almost identical! This demonstrates the relative ease with which a designer can port their existing legacy analog designs into digital.</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="656" height="663" src="https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace.png" alt="" class="wp-image-20889" srcset="https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace.png 656w, https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace-297x300.png 297w, https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace-80x80.png 80w, https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace-36x36.png 36w, https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace-120x120.png 120w, https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace-450x455.png 450w" sizes="auto, (max-width: 656px) 100vw, 656px" /></figure></div>


<h2 class="wp-block-heading">Automatic code generation to Arm Cortex-M processors</h2>



<p>As mentioned at the beginning of this article, the ASN filter designer’s automatic code generation engine facilitates the export of a designed filter to Cortex-M Arm based processor cores via the CMSIS-DSP software framework. </p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-3 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<p>The tool’s built-in analytics and help functions assist the designer in successfully configuring the design for deployment. Professional licence users may expedite the deployment by using the <strong>Arm deployment wizard</strong> that automates the steps described below.</p>
</div>



<div class="wp-block-column is-vertically-aligned-center is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%">
<figure class="wp-block-image size-full"><img loading="lazy" decoding="async" width="326" height="274" src="https://www.advsolned.com/wp-content/uploads/2018/09/Armwizard.png" alt="" class="wp-image-17853" srcset="https://www.advsolned.com/wp-content/uploads/2018/09/Armwizard.png 326w, https://www.advsolned.com/wp-content/uploads/2018/09/Armwizard-300x252.png 300w" sizes="auto, (max-width: 326px) 100vw, 326px" /></figure>
</div>
</div>



<h3 class="wp-block-heading"><span class="" style="display:block;clear:both;height: 0px;padding-top: 25px;border-top-width:0px;border-bottom-width:0px;"></span><strong>Steps required for Educational licence</strong> <strong>users</strong></h3>



<p>Before generating the code, the H2 filter (i.e. the filter designed in FilterScript) needs to be firstly re-optimised (transformed) to an H1 filter (main filter) structure for deployment. The <strong>options</strong> menu can be found under the <strong>P-Z</strong> tab in the main UI.</p>


<div class="wp-block-image">
<figure class="aligncenter size-large"><a href="http://www.advsolned.com/wp-content/uploads/2018/09/reopt_preemp.png"><img loading="lazy" decoding="async" width="359" height="127" src="https://www.advsolned.com/wp-content/uploads/2020/04/reopt_preemp-1.png" alt="" class="wp-image-12257" srcset="https://www.advsolned.com/wp-content/uploads/2020/04/reopt_preemp-1.png 359w, https://www.advsolned.com/wp-content/uploads/2020/04/reopt_preemp-1-300x106.png 300w" sizes="auto, (max-width: 359px) 100vw, 359px" /></a></figure></div>


<p><span class="" style="display:block;clear:both;height: 0px;padding-top: 5px;border-top-width:0px;border-bottom-width:0px;"></span>All floating point IIR filters designs must be based on <strong>Single Precision</strong> arithmetic and either a <strong>Direct Form I</strong> or <strong>Direct Form II Transposed</strong> filter structure. The <strong>Direct Form II Transposed</strong> structure is advocated for floating point implementation by virtue of its higher numerically accuracy.</p>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-4 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.3%">
<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="284" height="247" src="https://www.advsolned.com/wp-content/uploads/2020/04/preempQoptions-2.png" alt="" class="wp-image-12258"/></figure>
</div>



<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<p>Quantisation and filter structure settings can be found under the <strong>Q</strong> tab (as shown on the left). Setting <strong>Arithmetic</strong> to <strong>Single Precision</strong> and <strong>Structure</strong> to <strong>Direct Form II Transposed</strong> and clicking on the <strong>Apply</strong> button configures the IIR considered herein for the CMSIS-DSP software framework.</p>
</div>
</div>



<h3 class="wp-block-heading"></h3>


<span class="" style="display:block;clear:both;height: 0px;padding-top: 20px;border-top-width:0px;border-bottom-width:0px;"></span>



<p><strong>Arm CMSIS-DSP application C code</strong></p>



<p>Select the <strong>Arm CMSIS-DSP</strong> framework from the selection box in the filter summary window:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="170" height="183" src="https://www.advsolned.com/wp-content/uploads/2018/09/codegeneratoroptions.png" alt="" class="wp-image-17875"/></figure></div>


<p>The automatically generated C code based on the CMSIS-DSP framework for direct implementation on an Arm based Cortex-M processor is shown below:</p>


<div class="wp-block-image">
<figure class="aligncenter size-full"><img loading="lazy" decoding="async" width="686" height="638" src="https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace_code.png" alt="" class="wp-image-20891" srcset="https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace_code.png 686w, https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace_code-300x279.png 300w, https://www.advsolned.com/wp-content/uploads/2018/09/analog_vs_digital_laplace_code-450x419.png 450w" sizes="auto, (max-width: 686px) 100vw, 686px" /></figure></div>


<p>As seen, the automatic code generator generates all initialisation code, scaling and data structures needed to implement the IIR via the CMSIS-DSP library. This code may be directly used in any Cortex-M based development project &#8211; a <a style="color: #0000ff;" href="https://www2.keil.com/mdk5/cmsis/asnfd">complete Keil MDK example</a> is available on Arm/Keil&#8217;s website. Notice that the tool’s code generator produces code for the Cortex-M4 core as default, please refer to the table below for the <code>#define</code> definition required for all supported cores.</p>



<figure class="wp-block-table"><table><tbody><tr><td><code>ARM_MATH_CM0</code></td><td>Cortex-M0 core.</td><td><code>ARM_MATH_CM4</code></td><td>Cortex-M4 core.</td></tr><tr><td><code>ARM_MATH_CM0PLUS</code></td><td>Cortex-M0+ core.</td><td><code>ARM_MATH_CM7</code></td><td>Cortex-M7 core.</td></tr><tr><td><code>ARM_MATH_CM3</code></td><td>Cortex-M3 core.</td><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><code>ARM_MATH_ARMV8MBL</code></td><td>ARMv8M Baseline target (Cortex-M23 core).</td></tr><tr><td><code>ARM_MATH_ARMV8MML</code></td><td>ARMv8M Mainline target (Cortex-M33 core).</td></tr></tbody></table></figure>



<p>The main test loop code (not shown) centres around the <code>arm_biquad_cascade_df2T_f32()</code> function, which performs the filtering operation on a block of input data.</p>



<h2 class="wp-block-heading">What have we learned?</h2>



<p>The <strong>ASN Filter Designer provides engineers with everything they need</strong> in order to port legacy analog filter designs to a variety of Cortex-M processor cores.</p>



<p>The FilterScript symbolic math scripting language offers designers the ability to take an existing analog filter transfer function and transform it to digital (via the Bilinear z-transform or matched z-transform) with just a few lines of code.</p>



<p>The Arm automatic code generator analyses the designed digital filter and then <strong>automatically generates Arm CMSIS-DSP compliant C code</strong> suitable for direct implementation on a Cortex-M based microcontroller.</p>


<span class="" style="display:block;clear:both;height: 0px;padding-top: 15px;border-top-width:0px;border-bottom-width:0px;"></span>



<h3 class="wp-block-heading"><strong>Extra resources</strong></h3>



<ol class="wp-block-list">
<li>Step by step <a style="color: #0000ff;" href="https://youtu.be/ltikbqR9nK8">video tutorial</a> of designing an IIR and deploying it to Keil MDK uVision.</li>



<li>Implementing Biquad IIR filters with the ASN Filter Designer and the Arm CMSIS-DSP software framework <a style="color: #0000ff;" href="https://www.advsolned.com/wp-content/uploads/2018/05/Implementing-Biquad-IIR-filters-with-the-ASN-Filter-Designer-and-the-ARM-CMSIS-DSP-software-framework.pdf">(ASN-AN025)</a></li>



<li>Keil MDK uVision <a style="color: #0000ff;" href="http://www2.keil.com/mdk5/cmsis/asnfd">example IIR filter project</a></li>
</ol>


<span class="" style="display:block;clear:both;height: 0px;padding-top: 20px;border-top-width:0px;border-bottom-width:0px;"></span>



<div class="wp-block-columns is-layout-flex wp-container-core-columns-is-layout-5 wp-block-columns-is-layout-flex">
<div class="wp-block-column is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:33.33%">
<figure class="wp-block-image size-large"><img decoding="async" src="https://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox.png" alt=""/></figure>
</div>



<div class="wp-block-column is-vertically-aligned-center has-medium-font-size is-layout-flow wp-block-column-is-layout-flow" style="flex-basis:66.66%">
<div class="wp-block-buttons is-vertical is-layout-flex wp-container-core-buttons-is-layout-1 wp-block-buttons-is-layout-flex">
<div class="wp-block-button has-custom-width wp-block-button__width-75 is-style-outline is-style-outline--1"><a class="wp-block-button__link has-vivid-cyan-blue-background-color has-text-color has-background wp-element-button" href="https://www.advsolned.com/request-form-asn-filter-designer-demo/" style="color:#ffffff">Download Demo</a></div>
</div>



<div class="wp-block-buttons is-vertical is-layout-flex wp-container-core-buttons-is-layout-2 wp-block-buttons-is-layout-flex">
<div class="wp-block-button has-custom-width wp-block-button__width-75 is-style-outline is-style-outline--2"><a class="wp-block-button__link has-vivid-cyan-blue-background-color has-text-color has-background wp-element-button" href="https://www.advsolned.com/pricing-and-licencing/" style="color:#ffffff">Pricing and Licencing</a></div>
</div>
</div>
</div>


<p><span class="" style="display:block;clear:both;height: 0px;padding-top: 25px;border-top-width:0px;border-bottom-width:0px;"></span>
                
                    <!--begin code -->

                    
                    <div class="pp-multiple-authors-boxes-wrapper pp-multiple-authors-wrapper pp-multiple-authors-layout-boxed multiple-authors-target-shortcode box-post-id-19551 box-instance-id-1 ppma_boxes_19551"
                    data-post_id="19551"
                    data-instance_id="1"
                    data-additional_class="pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode"
                    data-original_class="pp-multiple-authors-boxes-wrapper pp-multiple-authors-wrapper box-post-id-19551 box-instance-id-1">
                                                                                    <h2 class="widget-title box-header-title">Author</h2>
                                                                            <span class="ppma-layout-prefix"></span>
                        <div class="ppma-author-category-wrap">
                                                                                                                                    <span class="ppma-category-group ppma-category-group-1 category-index-0">
                                                                                                                        <ul class="pp-multiple-authors-boxes-ul author-ul-0">
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                                    <li class="pp-multiple-authors-boxes-li author_index_0 author_ssarpal has-avatar">
                                                                                                                                                                                    <div class="pp-author-boxes-avatar">
                                                                    <div class="avatar-image">
                                                                                                                                                                                                                <img alt='' src='https://www.advsolned.com/wp-content/uploads/2023/05/sanjeevsarpal.jpeg' srcset='https://www.advsolned.com/wp-content/uploads/2023/05/sanjeevsarpal.jpeg' class='multiple_authors_guest_author_avatar avatar' height='80' width='80'/>                                                                                                                                                                                                            </div>
                                                                                                                                    </div>
                                                            
                                                            <div class="pp-author-boxes-avatar-details">
                                                                <div class="pp-author-boxes-name multiple-authors-name"><a href="https://www.advsolned.com/author/ssarpal/" rel="author" title="Dr. Sanjeev Sarpal" class="author url fn">Dr. Sanjeev Sarpal</a></div>                                                                                                                                                                                                        <p class="pp-author-boxes-description multiple-authors-description author-description-0">
                                                                                                                                                    Sanjeev is a RTEI (Real-Time Edge Intelligence) visionary and expert in signals and systems with a track record of successfully developing over 26 commercial products. He is a Distinguished Arm Ambassador and advises top international blue chip companies on their AIoT/RTEI solutions and strategies for I5.0, telemedicine, smart healthcare, smart grids and smart buildings.                                                                                                                                                </p>
                                                                                                                                
                                                                                                                                    <span class="pp-author-boxes-meta multiple-authors-links">
                                                                        <a href="https://www.advsolned.com/author/ssarpal/" title="View all posts">
                                                                            <span>View all posts</span>
                                                                        </a>
                                                                    </span>
                                                                                                                                <a class="ppma-author-user_email-profile-data ppma-author-field-meta ppma-author-field-type-email" aria-label="Email" href="mailto:sanjeev.sarpal@advsolned.com"  target="_self"><span class="dashicons dashicons-email-alt"></span> </a>
                                                                                                                            </div>
                                                                                                                                                                                                                        </li>
                                                                                                                                                                                                                                    </ul>
                                                                            </span>
                                                                                                                        </div>
                        <span class="ppma-layout-suffix"></span>
                                            </div>
                    <!--end code -->
                    
                
                                <style>
                .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-avatar img { 
        width: 80px !important; 
        height: 80px !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-avatar img {
        border-radius: 50% !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-meta a {
        background-color: #655997 !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-meta a {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-meta a:hover {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data {
        background-color: #655997 !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data {
        border-radius: 100% !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data:hover {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data {
        background-color: #655997 !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data {
        border-radius: 100% !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data:hover {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-recent-posts-title {
        border-bottom-style: dotted !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-multiple-authors-boxes-li {
        border-style: solid !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-multiple-authors-boxes-li {
        color: #3c434a !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-multiple-authors-boxes-li {
        border-radius: px !important; 
    }

            </style>
        
        </p>
		<div class="wpulike wpulike-default " ><div class="wp_ulike_general_class wp_ulike_is_not_liked"><button type="button"
					aria-label="Like Button"
					data-ulike-id="7792"
					data-ulike-nonce="f3e1431e27"
					data-ulike-type="post"
					data-ulike-template="wpulike-default"
					data-ulike-display-likers=""
					data-ulike-likers-style="popover"
					class="wp_ulike_btn wp_ulike_put_image wp_post_btn_7792"></button><span class="count-box wp_ulike_counter_up" data-ulike-counter-value="+3"></span>			</div></div>
	<p>The post <a rel="nofollow" href="https://www.advsolned.com/deploying-legacy-analog-filters-to-arm-cortex-m-processors/">Deploying legacy analog filters to Arm Cortex-M processor cores</a> appeared first on <a rel="nofollow" href="https://www.advsolned.com">ASN Home</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.advsolned.com/deploying-legacy-analog-filters-to-arm-cortex-m-processors/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Converting analog into digital filters</title>
		<link>https://www.advsolned.com/converting-analog-digital-filters/</link>
					<comments>https://www.advsolned.com/converting-analog-digital-filters/#respond</comments>
		
		<dc:creator><![CDATA[Dr. Sanjeev Sarpal]]></dc:creator>
		<pubDate>Thu, 02 Aug 2018 15:44:21 +0000</pubDate>
				<category><![CDATA[ASN FilterScript]]></category>
		<category><![CDATA[analog filters]]></category>
		<category><![CDATA[analog prototype]]></category>
		<category><![CDATA[analog-digital transform]]></category>
		<category><![CDATA[analog-to-digital]]></category>
		<category><![CDATA[BZT]]></category>
		<category><![CDATA[IIT]]></category>
		<category><![CDATA[lowpass]]></category>
		<category><![CDATA[transforms]]></category>
		<guid isPermaLink="false">http://www.advsolned.com/?p=6364</guid>

					<description><![CDATA[<p>The post <a rel="nofollow" href="https://www.advsolned.com/converting-analog-digital-filters/">Converting analog into digital filters</a> appeared first on <a rel="nofollow" href="https://www.advsolned.com">ASN Home</a>.</p>
]]></description>
										<content:encoded><![CDATA[<section class="av_textblock_section "  itemscope="itemscope" itemtype="https://schema.org/BlogPosting" itemprop="blogPost" ><div class='avia_textblock  '   itemprop="text" ><h2><strong>Upgrading legacy designs based on analog filters</strong></h2>
<p>Analog filters have been around since the beginning of electronics, ranging from simple inductor-capacitor networks to more advanced active filters with op-amps. As such, there is a rich collection of tried and tested legacy filter designs for a broad range of sensor measurement applications. However, with the performance requirements of modern IoT (Internet of Things) sensor measurement applications and lower product costs, digital filters integrated into the microcontroller&#8217;s application code are becoming the norm, but <strong>how can we get the best of both worlds</strong>?</p>
<p>Rather than re-inventing the wheel, product designers can take an existing analog filter transfer function, transform it to digital (via a transform) and implement it as digital filter in a microcontroller or DSP (digital signal processor). Although  <strong>analog-to-digital transforms</strong> have been around for decades, the availability of DSP design tooling for tweaking the &#8216;transformed digital filter&#8217; has been somewhat limited, hindering the design and validation process.</p>
<p>A 2nd order analog lowpass filter is shown below, and in its simplest form, only 5 components are required to build the filter, which sounds easy. Right?<a href="http://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-6330 size-full" style="border: 1px solid #000000; margin-top: 10px; margin-bottom: 10px;" src="http://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt.png" alt="2nd order analog lowpass filter" width="1224" height="290" srcset="https://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt.png 1224w, https://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt-300x71.png 300w, https://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt-768x182.png 768w, https://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt-1030x244.png 1030w, https://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt-705x167.png 705w, https://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt-450x107.png 450w, https://www.advsolned.com/wp-content/uploads/2018/07/analog_loadcellfilt-1200x284.png 1200w" sizes="auto, (max-width: 1224px) 100vw, 1224px" /></a></p>
<p><strong>The pros</strong></p>
<p>The most obvious advantage is that analog filters have an excellent resolution, as there are no ‘number of bits’ to consider. Analog filters have good EMC (electromagnetic compatibility) properties as there is no clock generating noise. There are no effects of aliasing, which is certainly true for the simpler op-amps, which don’t have any fancy chopping or auto-calibration circuitry built into them, and analog designs can be cheap which is great for cost sensitive applications.</p>
<h3><strong>Sound great, but what’s the bad news?</strong></h3>
<p>Analog filters have several significant disadvantages that affect filter performance, such as component aging, temperature drift and component tolerance. Also, good performance requires good analog design skills and good PCB (printed circuit board) layout, which is hard to find in the contemporary skills market.</p>
<p>These disadvantages make digital filters much more attractive for modern applications, that require high repeatability of characteristics.  Looking at an example, let’s say that you want to manufacture 1000 measurement modules after optimising your filter design. With <strong>a digital solution you can be sure that the performance of your filter will be identical in all modules</strong>. This is certainly not the case with analog, as component tolerance, component aging and temperature drift mean that each module’s filter will have its own characteristics. Also, an analog filter&#8217;s frequency response remains fixed, i.e. a Butterworth filter will always be a Butterworth filter – any changes the frequency response would require physically changing components on the PCB – not ideal!</p>
<p>Digital filters are adaptive and flexible, we can design and implement a filter with any frequency response that we want, deploy it and then update the filter coefficients without changing anything on the PCB! It’s also easy to design digital filters with <strong>linear phase and at very low sampling frequencies</strong> – two things that are tricky with analog.</p>
<h2>Laplace to discrete/digital transforms</h2>
<p>The three methods discussed herein essentially involve transforming a Laplace (analog) transfer function, \(H(s)\) into a discrete transfer function, \(H(z)\) such that a tried and tested analog filter that is already used in a design may be implemented on a microcontroller or DSP.</p>
<p>A selection of some useful Laplace to z-transforms are given in table below:<span class="" style="display:block;clear:both;height: 0px;padding-top: 20px;border-top-width:0px;border-bottom-width:0px;"></span></p>
<p style="text-align: center;">\(<br />
\begin{array}{ccc}\hline<br />
H(s) &#038;\longleftrightarrow &#038; H(z) \\ \hline<br />
1 &#038;\longleftrightarrow &#038; 1 \\<br />
\frac{\displaystyle1}{\displaystyle s}<br />
&#038;\longleftrightarrow&#038; \frac{\displaystyle 1}{\displaystyle 1-z^{\scriptstyle -1}}\\<br />
\frac{\displaystyle 1}{\displaystyle s^{\scriptstyle 2}} &#038;\longleftrightarrow&#038; \frac{\displaystyle<br />
Tz^{\scriptstyle-1}}{\displaystyle (1-z^{\scriptstyle -1})^2}\\<br />
\frac{\displaystyle 1}{\displaystyle s+a}<br />
&#038;\longleftrightarrow&#038;<br />
\frac{\displaystyle 1}{\displaystyle 1-e^{-aT}z^{-1}}\\<br />
\frac{\displaystyle 1}{\displaystyle (s+a)^2}<br />
&#038;\longleftrightarrow&#038; \frac{\displaystyle z^{-1}(1-e^{-aT})}{\displaystyle a(1-z^{-1})(1-e^{-aT}z^{-1})}\\\hline<br />
\end{array}<br />
\)<span class="" style="display:block;clear:both;height: 0px;padding-top: 5px;border-top-width:0px;border-bottom-width:0px;"></span><br />
<em>A table of useful Laplace and z-transforms</em></p>
<span class="" style="display:block;clear:both;height: 0px;padding-top: 20px;border-top-width:0px;border-bottom-width:0px;"></span>
<h3><strong>The Bilinear z-transform (BZT)</strong></h3>
<p>The Bilinear z-transform (BZT), simply converts an analog transfer function, \(H(s)\) into a discrete transfer function, \(H(z)\) by replacing all \(s\) terms with the following:</p>
<p style="text-align: center;">\(\displaystyle<br />
s=\frac{2}{T}\frac{1-z^{-1}}{1+z^{-1}} \label{bzt}\)</p>
<p>where, \(T\) is the discrete system&#8217;s sampling period. However, substituting \(s=j\Omega\) and \(z=e^{jwT}\) into the BZT equation and simplifying, notice that there is actually a non-linear relationship between the analog, \(\Omega\) and discrete, \(w\) frequencies. This relationship is shown below, and is due to the nonlinearity of the arctangent function.</p>
<p style="text-align: center;">\(\displaystyle\omega=2\tan^{-1}\left(\frac{\Omega T}{2}\right)\label{bzt_warp_def1}\)</p>
<p>Analysing the equation, it can be seen that the equally spaced  analog frequencies in the range \( -\infty\lt\Omega\lt\infty\) are nonlinearly compressed in the frequency range \( -\pi\lt w\lt\pi\) in the discrete domain. This relationship is referred to as frequency warping, and may be compensated for by pre-warping the analog frequencies by:</p>
<p style="text-align: center;">\(\displaystyle<br />
\Omega_c=\frac{2}{T}\tan\left(\frac{\Omega_d T}{2}\right)<br />
\label{bzt_warp_def2}<br />
\)</p>
<p style="text-align: left;">where, \(\displaystyle\Omega_c\) is the compensated or pre-warped analog frequency, and \(\displaystyle\Omega_d\) is the desired analog frequency.</p>
<p style="text-align: left;">The ASN FilterScript command \(\texttt{bilinear}\) may be used convert a Laplace transfer function into its discrete equivalent using the BZT transform. An example is given <span style="color: #0000ff;"><a style="color: #0000ff;" href="#example">below</a></span>.</p>
<h3><strong>The Impulse Invariant Transform</strong></h3>
<p>The second transform, is referred to as the impulse invariant transform (IIT), since the poles of the Laplace transfer function are converted into their discrete equivalents, such that the discrete impulse response, \(h(n)\) is identical to a regularly sampled representation of the analog impulse response (i.e., \(h(n)=h(nT)\), where \(T\) is the sampling rate, and \(t=nT\)). The IIT is a much more tedious transformation technique than the BZT, since the Laplace transfer function must be firstly expanded using partial fractions before applying the transform.</p>
<p style="text-align: left;">The transformation technique is defined below:</p>
<p style="text-align: center;">\(\displaystyle<br />
\frac{K}{s+a} \quad\longrightarrow\quad<br />
\frac{K}{1-e^{-aT}z^{-1}} \label{iit_def}<br />
\)</p>
<p>This method <strong>suffers from several constraints</strong>, since it does not allow for the transformation of zeros or individual constant terms (once expanded), and must have a high sampling rate in order to overcome the effects of spectral aliasing. Indeed, the effects of aliasing hinder this method considerably, such that the method should only be used when the requirement is to match the analog transfer function&#8217;s impulse response, since the resulting discrete model may have a different magnitude and phase spectrum (frequency response) to that of the original analog system. Consequently, the impulse invariant method is unsuitable for modelling highpass filters, and is therefore limited to the modelling of lowpass or bandpass type filters.</p>
<p>Due to the aforementioned limitations of the IIT method, it is currently not supported in ASN Filterscript.</p>
<h3><strong>The Matched-z transformation</strong></h3>
<p>Another analog to discrete modelling technique is the matched-z transformation. As the name suggests, the transform<strong> converts the poles and zeros from the analog transfer function directly into poles and zeros in the z-plane</strong>. The transformation is described below, where \(T\) is the sampling rate.</p>
<p style="text-align: center;">\(\displaystyle<br />
\frac{\prod\limits_{k=1}^q(s+b_k)}{\prod\limits_{k=1}^p(s+a_k)}<br />
\quad\longrightarrow\quad<br />
\frac{\prod\limits_{k=1}^q(1-e^{-b_kT}z^{-1})}{\prod\limits_{k=1}^p(1-e^{-a_kT}z^{-1})}<br />
\label{matchedz_def}<br />
\)</p>
<p>Analysing the transform equation, it can be seen that the transformed z-plane poles will be identical to the poles obtained with the impulse invariant method. However, notice that the positions of the zeros will be different, since the impulse invariant method cannot transform them.</p>
<p>The ASN Filterscript command \(\texttt{mztrans}\) is available for this method.</p>
<h2 id="example">A detailed example</h2>
<p>In order to demonstrate the ease of transforming analog filters into their discrete/digital equivalents using the analog to discrete transforms, an example of modelling with the BZT will now follow for a 2nd order lowpass analog filter.</p>
<p>A generalised 2nd order lowpass analog filter is given by:</p>
<p style="text-align: center;">\(\displaystyle<br />
H(s)=\frac{w_c^2}{s^2+2\zeta w_c s + w_c^2}<br />
\)</p>
<p>where, \(w_c=2\pi f_c\) is the cut-off frequency and \(\zeta\) sets the damping of the filter,  where a  \(\zeta=1/\sqrt{2}\) is said to be critically damped or equal to -3dB at \(w_c\). Many analog engineers choose to specify a quality factor, \(Q =  \displaystyle\frac{1}{2\zeta}\) or peaking factor for their designs. Substituting \(Q\) into \(H(s)\), we obtain:</p>
<p style="text-align: center;">\(\displaystyle<br />
H(s)=\frac{w_c^2}{s^2+ \displaystyle{\frac{w_c}{Q}s} + w_c^2}<br />
\)</p>
<p style="text-align: left;">Analysing, \(H(s)\) notice that \(Q=1/\sqrt{2} = 0.707\) also results in a critically damped response. Various values of \(Q\) are shown below, and as seen when \(Q>1/\sqrt{2}\) peaking occurs.</p>
<p><a href="http://www.advsolned.com/wp-content/uploads/2018/08/analogQ.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-6680" src="http://www.advsolned.com/wp-content/uploads/2018/08/analogQ.png" alt="Values of Q" width="635" height="330" srcset="https://www.advsolned.com/wp-content/uploads/2018/08/analogQ.png 942w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQ-300x156.png 300w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQ-768x399.png 768w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQ-705x366.png 705w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQ-450x234.png 450w" sizes="auto, (max-width: 635px) 100vw, 635px" /></a></p>
<p style="text-align: center;"><em>2nd order lowpass filter prototype magnitude spectrum for various value of Q:<br />
notice that when \(Q>1/\sqrt{2}\) peaking occurs.</em></p>
<p>Before applying the BZT in ASN FilterScript, the analog transfer function must be specified in an analog filter object. The following code sets up an analog filter object for the 2nd order lowpass prototype considered herein:<br />
[code language=&#8221;java&#8221;]<br />
Main()</p>
<p>wc=2*pi*fc;<br />
Nb={0,0,wc^2};<br />
Na={1,wc/Q,wc^2};</p>
<p>Ha=analogtf(Nb,Na,1,&quot;symbolic&quot;); // make analog filter object<br />
[/code]<br />
The \(\texttt{symbolic}\) keyword generates a symbolic transfer function representation in the command window. For a sampling rate of \(f_s=500Hz\) and \(f_c=30Hz\) and \(Q=0.707\), we obtain:</p>
<p><a href="http://www.advsolned.com/wp-content/uploads/2018/08/analogTF.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-6683 size-full" src="http://www.advsolned.com/wp-content/uploads/2018/08/analogTF.png" alt="ASN FilterScript analog command" width="398" height="104" srcset="https://www.advsolned.com/wp-content/uploads/2018/08/analogTF.png 398w, https://www.advsolned.com/wp-content/uploads/2018/08/analogTF-300x78.png 300w" sizes="auto, (max-width: 398px) 100vw, 398px" /></a></p>
<p>Applying the BZT via the \(\texttt{bilinear}\) command without prewarping,<br />
[code language=&#8221;java&#8221; light=&#8221;true&#8221;] Hd=bilinear(Ha,0,&quot;symbolic&quot;); [/code]<br />
<a href="https://www.advsolned.com/wp-content/uploads/2018/08/bilinearTF.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-12435 size-full" src="https://www.advsolned.com/wp-content/uploads/2018/08/bilinearTF.png" alt="bilinear transformation" width="510" height="116" srcset="https://www.advsolned.com/wp-content/uploads/2018/08/bilinearTF.png 510w, https://www.advsolned.com/wp-content/uploads/2018/08/bilinearTF-300x68.png 300w, https://www.advsolned.com/wp-content/uploads/2018/08/bilinearTF-450x102.png 450w" sizes="auto, (max-width: 510px) 100vw, 510px" /></a></p>
<p>The complete frequency response of the transformed digital filter is shown below, where it can be seen that the at \(30Hz\) the magnitude is \(-3dB\) and the phase is \( -90^{\circ}\), which is as expected. Notice also how the filter&#8217;s magnitude roll-off  is affected by the double zero pair at Nyquist (see the z-plane chart below), leading to differences from its analog cousin. <span class="" style="display:block;clear:both;height: 0px;padding-top: 10px;border-top-width:0px;border-bottom-width:0px;"></span><a href="http://www.advsolned.com/wp-content/uploads/2018/08/analogQzp.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-6693" src="http://www.advsolned.com/wp-content/uploads/2018/08/analogQzp.png" alt="Pole-zero chart 2nd order LPF" width="353" height="353" srcset="https://www.advsolned.com/wp-content/uploads/2018/08/analogQzp.png 357w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQzp-80x80.png 80w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQzp-300x300.png 300w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQzp-36x36.png 36w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQzp-180x180.png 180w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQzp-120x120.png 120w" sizes="auto, (max-width: 353px) 100vw, 353px" /></a></p>
<p><a href="http://www.advsolned.com/wp-content/uploads/2018/08/analogQfr.png"><img loading="lazy" decoding="async" class="aligncenter wp-image-6686" src="http://www.advsolned.com/wp-content/uploads/2018/08/analogQfr.png" alt="2nd order LPF" width="513" height="581" srcset="https://www.advsolned.com/wp-content/uploads/2018/08/analogQfr.png 580w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQfr-265x300.png 265w, https://www.advsolned.com/wp-content/uploads/2018/08/analogQfr-450x509.png 450w" sizes="auto, (max-width: 513px) 100vw, 513px" /></a></p>
<p>The pole-zero positions may be tweaked within ASN Filterscript or via the ASN Filter Designer&#8217;s interactive pole-zero z-plane plot editor by just using the mouse!</p>
<h2>Implementation</h2>
<p>The complete code for transforming a generalised 2nd order analog  lowpass filter prototype into its digital equivalent using the BZT via <span style="color: #0000ff;"><a style="color: #0000ff;" href="http://www.advsolned.com/asn_filter_designer/#live-math-scripting">ASN FilterScript</a></span> is given below:<span class="" style="display:block;clear:both;height: 0px;padding-top: 10px;border-top-width:0px;border-bottom-width:0px;"></span><br />
[code language=&#8221;java&#8221;]</p>
<p>ClearH1;  // clear primary filter from cascade<br />
interface Q = {0.1,10,0.02,0.707};<br />
interface fc = {10,200,10,40};</p>
<p>Main()</p>
<p>wc=2*pi*fc;<br />
Nb={0,0,wc^2};<br />
Na={1,wc/Q,wc^2};</p>
<p>Ha=analogtf(Nb,Na,1,&quot;symbolic&quot;); // make analog filter object<br />
Hd=bilinear(Ha,0,&quot;symbolic&quot;); // transform Ha via BZT into digital object, Hd</p>
<p>Num=getnum(Hd);<br />
Den=getden(Hd);<br />
Gain=getgain(Hd);</p>
<p>[/code]<br />
<span class="" style="display:block;clear:both;height: 0px;padding-top: 20px;border-top-width:0px;border-bottom-width:0px;"></span></p>
<p><a href="https://www.advsolned.com/asn_filter_designer/"><img loading="lazy" decoding="async" class="alignleft wp-image-3310" style="margin: 10px 80px 10px 20px;" src="http://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox.png" alt="ASN Filter Designer Box" width="183" height="253" srcset="https://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox.png 800w, https://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox-217x300.png 217w, https://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox-768x1062.png 768w, https://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox-745x1030.png 745w, https://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox-510x705.png 510w, https://www.advsolned.com/wp-content/uploads/2018/02/ASNFDbox-450x622.png 450w" sizes="auto, (max-width: 183px) 100vw, 183px" /></a></p>
<p style="text-align: left;"><a class="button" href="http://www.advsolned.com/request-form-asn-filter-designer-demo/">Download demo now</a></p>
<p><a class="button" href="http://www.advsolned.com/pricing-and-licencing/#Best_licence_forme">Licencing information</a><br />
<span class="" style="display:block;clear:both;height: 0px;padding-top: 30px;border-top-width:0px;border-bottom-width:0px;"></span></p>
</div></section><br />
<span class="" style="display:block;clear:both;height: 0px;padding-top: 20px;border-top-width:0px;border-bottom-width:0px;"></span>
                
                    <!--begin code -->

                    
                    <div class="pp-multiple-authors-boxes-wrapper pp-multiple-authors-wrapper pp-multiple-authors-layout-boxed multiple-authors-target-shortcode box-post-id-19551 box-instance-id-1 ppma_boxes_19551"
                    data-post_id="19551"
                    data-instance_id="1"
                    data-additional_class="pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode"
                    data-original_class="pp-multiple-authors-boxes-wrapper pp-multiple-authors-wrapper box-post-id-19551 box-instance-id-1">
                                                                                    <h2 class="widget-title box-header-title">Author</h2>
                                                                            <span class="ppma-layout-prefix"></span>
                        <div class="ppma-author-category-wrap">
                                                                                                                                    <span class="ppma-category-group ppma-category-group-1 category-index-0">
                                                                                                                        <ul class="pp-multiple-authors-boxes-ul author-ul-0">
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                    
                                                                                                                    <li class="pp-multiple-authors-boxes-li author_index_0 author_ssarpal has-avatar">
                                                                                                                                                                                    <div class="pp-author-boxes-avatar">
                                                                    <div class="avatar-image">
                                                                                                                                                                                                                <img alt='' src='https://www.advsolned.com/wp-content/uploads/2023/05/sanjeevsarpal.jpeg' srcset='https://www.advsolned.com/wp-content/uploads/2023/05/sanjeevsarpal.jpeg' class='multiple_authors_guest_author_avatar avatar' height='80' width='80'/>                                                                                                                                                                                                            </div>
                                                                                                                                    </div>
                                                            
                                                            <div class="pp-author-boxes-avatar-details">
                                                                <div class="pp-author-boxes-name multiple-authors-name"><a href="https://www.advsolned.com/author/ssarpal/" rel="author" title="Dr. Sanjeev Sarpal" class="author url fn">Dr. Sanjeev Sarpal</a></div>                                                                                                                                                                                                        <p class="pp-author-boxes-description multiple-authors-description author-description-0">
                                                                                                                                                    Sanjeev is a RTEI (Real-Time Edge Intelligence) visionary and expert in signals and systems with a track record of successfully developing over 26 commercial products. He is a Distinguished Arm Ambassador and advises top international blue chip companies on their AIoT/RTEI solutions and strategies for I5.0, telemedicine, smart healthcare, smart grids and smart buildings.                                                                                                                                                </p>
                                                                                                                                
                                                                                                                                    <span class="pp-author-boxes-meta multiple-authors-links">
                                                                        <a href="https://www.advsolned.com/author/ssarpal/" title="View all posts">
                                                                            <span>View all posts</span>
                                                                        </a>
                                                                    </span>
                                                                                                                                <a class="ppma-author-user_email-profile-data ppma-author-field-meta ppma-author-field-type-email" aria-label="Email" href="mailto:sanjeev.sarpal@advsolned.com"  target="_self"><span class="dashicons dashicons-email-alt"></span> </a>
                                                                                                                            </div>
                                                                                                                                                                                                                        </li>
                                                                                                                                                                                                                                    </ul>
                                                                            </span>
                                                                                                                        </div>
                        <span class="ppma-layout-suffix"></span>
                                            </div>
                    <!--end code -->
                    
                
                                <style>
                .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-avatar img { 
        width: 80px !important; 
        height: 80px !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-avatar img {
        border-radius: 50% !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-meta a {
        background-color: #655997 !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-meta a {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-meta a:hover {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data {
        background-color: #655997 !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data {
        border-radius: 100% !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_url-profile-data:hover {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data {
        background-color: #655997 !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data {
        border-radius: 100% !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .ppma-author-user_email-profile-data:hover {
        color: #ffffff !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-author-boxes-recent-posts-title {
        border-bottom-style: dotted !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-multiple-authors-boxes-li {
        border-style: solid !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-multiple-authors-boxes-li {
        color: #3c434a !important; 
    }

    .pp-multiple-authors-boxes-wrapper.pp-multiple-authors-layout-boxed.multiple-authors-target-shortcode .pp-multiple-authors-boxes-li {
        border-radius: px !important; 
    }

            </style>
        
        </p>
		<div class="wpulike wpulike-default " ><div class="wp_ulike_general_class wp_ulike_is_not_liked"><button type="button"
					aria-label="Like Button"
					data-ulike-id="6364"
					data-ulike-nonce="e4809d4995"
					data-ulike-type="post"
					data-ulike-template="wpulike-default"
					data-ulike-display-likers=""
					data-ulike-likers-style="popover"
					class="wp_ulike_btn wp_ulike_put_image wp_post_btn_6364"></button><span class="count-box wp_ulike_counter_up" data-ulike-counter-value="+4"></span>			</div></div>
	<p>The post <a rel="nofollow" href="https://www.advsolned.com/converting-analog-digital-filters/">Converting analog into digital filters</a> appeared first on <a rel="nofollow" href="https://www.advsolned.com">ASN Home</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.advsolned.com/converting-analog-digital-filters/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
