{"id":196,"date":"2023-02-27T20:42:57","date_gmt":"2023-02-28T01:42:57","guid":{"rendered":"https:\/\/leapfrog.hopto.org\/wolfy\/?page_id=196"},"modified":"2023-02-27T20:42:57","modified_gmt":"2023-02-28T01:42:57","slug":"cellular-automata-memory","status":"publish","type":"page","link":"https:\/\/leapfrog.hopto.org\/wolfy\/?page_id=196","title":{"rendered":"Cellular Automata Memory"},"content":{"rendered":"\n<p>Two links discussing software implementations of low pass filters can be found at <a href=\"https:\/\/dsp.stackexchange.com\/questions\/60277\/is-the-typical-implementation-of-low-pass-filter-in-c-code-actually-not-a-typica\">stackexchange<\/a> and <a href=\"https:\/\/kiritchatterjee.wordpress.com\/2014\/11\/10\/a-simple-digital-low-pass-filter-in-c\/\">Kirit Chatterjee&#8217;s blog<\/a>.<\/p>\n\n\n\n<p>From stackexchange:<\/p>\n\n\n\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<div class=\"wp-block-group has-global-padding is-layout-constrained wp-block-group-is-layout-constrained\">\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p>The main benefit of a &#8220;proper&#8221; low pass filter is that you have a zero at Nyquist and you get much more attenuation very close to Nyquist.<\/p>\n\n\n\n<p>If you care, the C code is almost identical and easy enough to write. Using your notation it looks like<\/p>\n\n\n\n<p><em>y<\/em>[<em>n<\/em>]=(1\u2212<em>a<\/em>)\u22c5<em>y<\/em>[<em>n<\/em>\u22121]+<em>a<\/em>\u22c5(<em>x<\/em>[<em>n<\/em>]+<em>x<\/em>[<em>n<\/em>\u22121])\/2<\/p>\n\n\n\n<p>The only difference is that instead of adding just the current input sample, you add the average of the last two inputs.<\/p>\n<\/blockquote>\n<\/div>\n<\/div>\n\n\n\n<p>and from Kirit Chatterjee:<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>int RawData;\nsigned long SmoothDataINT;\nsigned long SmoothDataFP; \nint Beta = 4; \/\/ Length of the filter &lt; 16\n\nvoid main (void){\n    while(1){\n       \/\/ Function that brings Fresh Data into RawData\n       RawData = GetRawData();\n       RawData &lt;&lt;= FP_Shift; \/\/ Shift to fixed point\n       SmoothDataFP = (SmoothDataFP&lt;&lt; Beta)-SmoothDataFP; \n       SmoothDataFP += RawData;\n       SmoothDataFP &gt;&gt;= Beta;\n       \/\/ Don't do the following shift if you want to do further\n       \/\/ calculations in fixed-point using SmoothData\n       SmoothDataINT = SmoothDataFP&gt;&gt; FP_Shift;\n    }\n}<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Two links discussing software implementations of low pass filters can be found at stackexchange and Kirit Chatterjee&#8217;s blog. From stackexchange: The main benefit of a &#8220;proper&#8221; low pass filter is that you have a zero at Nyquist and you get much more attenuation very close to Nyquist. If you care, the C code is almost [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-196","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=\/wp\/v2\/pages\/196","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=196"}],"version-history":[{"count":1,"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=\/wp\/v2\/pages\/196\/revisions"}],"predecessor-version":[{"id":197,"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=\/wp\/v2\/pages\/196\/revisions\/197"}],"wp:attachment":[{"href":"https:\/\/leapfrog.hopto.org\/wolfy\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}