{"id":572,"date":"2017-01-04T00:46:19","date_gmt":"2017-01-04T08:46:19","guid":{"rendered":"http:\/\/www.earlevel.com\/main\/?p=572"},"modified":"2020-12-12T10:45:57","modified_gmt":"2020-12-12T18:45:57","slug":"about-coefficient-conventions","status":"publish","type":"post","link":"https:\/\/www.earlevel.com\/main\/2017\/01\/04\/about-coefficient-conventions\/","title":{"rendered":"About coefficient conventions"},"content":{"rendered":"<p>It\u2019s been asked many times, so it\u2019s worth an article explaining the conventions used on this site for transfer functions, and why they may differ from what you see elsewhere.<\/p>\n<p>People run into this most often with biquads: I use <em>a<\/em> (<em>a<\/em><sub>0<\/sub>, <em>a<\/em><sub>1<\/sub>, <em>a<\/em><sub>2<\/sub>) in the numerator (defining zeros), and <em>b<\/em> in the denominator (defining poles). Many references, including wikipedia, use the opposite convention. Why am I so contrary?<\/p>\n<p>OK, I go back a few years, back when the only way to find out about digital signal processing was to buy a college text book and try to make sense of it. In the beginning, there was no convention (I\u2019m not sure there is now, other than de facto\u2014please let me know if some technical society or other has put down the word). When I first went to write for the public, I took a survey of my book shelf. Most had <em>a<\/em> on top. And that choice made sense to me\u2014<em>a<\/em> then <em>b<\/em>, from top to bottom, and also left to right for the direct form I structure. Finally, it makes sense that FIRs would have only <em>a<\/em> coefficients. Having only <em>b<\/em> coefficients seems odd, if you were to specialize the general transfer function.<\/p>\n<p>My only guess for the other way preference, initially at least, is that when using the canonical (minimum number of delay elements) director form II, the result would be <em>a<\/em>&#8211;<em>b<\/em> left to right.<\/p>\n<p>So, I wrote a number of articles over the years using that convention. And over the years it seems that <em>b<\/em>-on-top has become dominant. (I recall seeing <em>a<\/em>-on-top on another major internet resource recently, and I see that one site even uses <em>c<\/em> and <em>d<\/em>\u2014I assume to avoid the conflict altogether.) Free time is not something I have a lot of, so I don\u2019t intend to edit all my articles, diagrams, and widgets to change the convention. I\u2019m not saying it will never happen, but not for now.<\/p>\n<p>It\u2019s easy enough to notice which convention is used if you\u2019re aware that there is no 100% agreement. Biquads (and higher order IIRs) are typically normalized to the output, making <em>b<\/em><sub>0<\/sub> (in my case) unity, so there is no coefficient needed. If you see a set of <em>a<\/em> and <em>b<\/em> coefficients, and <em>a<\/em><sub>0<\/sub> is missing and <em>b<\/em><sub>0<\/sub> is not, then the order is swapped relative to mine.<\/p>\n<p>Finally, there is one other place that you can get caught with filter coefficients. When deriving a difference equation (<em>y<\/em>(<em>n<\/em>) = <em>a<\/em><sub>0<\/sub><em>x<\/em>(<em>n<\/em>) + <em>a<\/em><sub>1<\/sub><em>x<\/em>(<em>n<\/em>-1) + <em>a<\/em><sub>2<\/sub><em>x<\/em>(<em>n<\/em>-2) &#8211; <em>b<\/em><sub>1<\/sub><em>y<\/em>(<em>n<\/em>-1) &#8211; <em>b<\/em><sub>2<\/sub><em>y<\/em>(<em>n<\/em>-2)), sometimes people roll the minus signs for the feedback part into the respective coefficients. This damages the mathematical purity of it all a tad, but makes sense in a computer implementation. I don\u2019t merge the minus signs\u2014and fortunately, I don\u2019t think most internet sources do either.<\/p>\n<p>For the record, I\u2019ll consult my bookshelf and see if I can come up with that original survey I mentioned earlier:<\/p>\n<h3><em>a<\/em> on top<\/h3>\n<p><em>Theory and Application of Digital Signal Processing<\/em>, Rabiner and Gold, 1975<br \/>\n<em>Principles of Digital Audio\u2014Second Edition<\/em>, Pohlmann, 1989*<br \/>\n<em>Advanced Digital Audio<\/em>, Pohlmann, 1991<br \/>\n<em>Digital Signal Processing\u2014A Practical Approach<\/em>, Ifeachor and Jervis, 1993<br \/>\n<em>Digital Audio Signal Processing<\/em>, Z\u00f6lzer, 1997<br \/>\n<em>Digital Signal Processing\u2014An Anthology: Chapter 2, An Introduction to Digital Filter Theory<\/em>, Julius O. Smith, 1983<\/p>\n<p>* The topic doesn\u2019t appear in the first edition. Also, although the text uses <em>a<\/em> for the top (forward path of the difference equations, actually), a diagram of the direct form II structure shows the opposite. Since Pohlmann is consistent, otherwise, it seems the diagram was taken from somewhere else.<\/p>\n<h3><em>b<\/em> on top<\/h3>\n<p>I thought I had a few\u2014can\u2019t find any at the moment. Perhaps TI and Motorola application notes?<\/p>\n<h3><em>N<\/em> on top, <em>D<\/em> on bottom (Numerator and Denominator!)<\/h3>\n<p><em>Multirate Digital Signal Processing<\/em>, Rochiere and Rabiner, 1983<\/p>\n<h3>Other (these don\u2019t use indexed coefficients)<\/h3>\n<p><em>Digital signal Analysis<\/em>, Sterns, 1975<br \/>\n<em>Musical Applications of Microprocessors<\/em>, Chamberlin, 1980<\/p>\n<h3>Final notes<\/h3>\n<p>Again, the textbook survey is to show why I made the choice then, not to support why it should be that way now. Be aware that you can\u2019t assume that a given author is consistent over time. Rabiner\u2019s books use different conventions, with different co-authors, as noted. Julius O. Smith\u2019s detailed 1983 article has <em>a<\/em> on top, while his vast web resources use <em>b<\/em> on top. In <em>DAFX: Digital Audio Effects<\/em> (like <em>Anthology<\/em> above, a collection from multiple authors), Z\u00f6lzer has <em>b<\/em> on top. It\u2019s always a good idea to pay attention\u2014there is nothing magical about the coefficient naming, it\u2019s simply a style consideration.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It\u2019s been asked many times, so it\u2019s worth an article explaining the conventions used on this site for transfer functions, and why they may differ from what you see elsewhere. People run into this most often with biquads: I use &hellip; <a href=\"https:\/\/www.earlevel.com\/main\/2017\/01\/04\/about-coefficient-conventions\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[21,9],"tags":[],"_links":{"self":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/572"}],"collection":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/comments?post=572"}],"version-history":[{"count":22,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/572\/revisions"}],"predecessor-version":[{"id":595,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/572\/revisions\/595"}],"wp:attachment":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/media?parent=572"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/categories?post=572"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/tags?post=572"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}