{"id":442,"date":"2016-12-08T15:11:36","date_gmt":"2016-12-08T23:11:36","guid":{"rendered":"http:\/\/www.earlevel.com\/main\/?p=442"},"modified":"2019-04-30T16:41:50","modified_gmt":"2019-04-30T23:41:50","slug":"filter-frequency-response-grapher","status":"publish","type":"post","link":"https:\/\/www.earlevel.com\/main\/2016\/12\/08\/filter-frequency-response-grapher\/","title":{"rendered":"Filter frequency response grapher"},"content":{"rendered":"<p>Here\u2019s a tool that plots frequency response from filter coefficients.<\/p>\n<style type=\"text\/css\">\n#content table {\n\tborder: 1px solid #e7e7e7;\n\tmargin: 0 0 0 0;\n}\n#content tr td {\n    border: none;\n    padding: 4px 4px;\n}\n<\/style>\n<style type=\"text\/css\">\n#freqrestable { \n    margin-bottom:6px; \n} \n#freqrestable:after { \n    content: \" \"; \n    clear:both; \n    display:block; \n} \n#col1, #col2 { \n    margin-right: 1px; \n    float: left; \n    font-size: 10pt;\n} \n#col1 { \n    width: 140px;\n} \n<\/style>\n<div id=\"magnitude_20161207\" style=\"width:600px; height:200px;\"><\/div>\n<div id=\"freqrestable\">\n<div id=\"col1\">\n<input id=\"Fs_20161207\" value=\"44100\" style=\"text-align:right;width:4em;margin: 0 6px 6px 0;font-size:10pt;\" type=\"text\" onchange='updateFreqRes();'>Hz\n<\/div>\n<div id=\"col1\">\n<select id=\"plotType_20161207\" onchange='updateFreqRes();'><option value=\"linear\">linear<\/option><option value=\"log 10\">log 10<\/option><option value=\"log 2\">log 2<\/option><\/select> Plot\n<\/div>\n<div id=\"col1\">\n<select id=\"max_20161207\" onchange='updateFreqRes();'><option value=\"auto\" selected=\"selected\">auto<\/option><option value=\"40\">40 dB<\/option><option value=\"30\">30 dB<\/option><option value=\"20\">20 dB<\/option><option value=\"10\">10 dB<\/option><option value=\"0\">0 dB<\/option><option value=\"-10\">-10 dB<\/option><option value=\"-20\">-20 dB<\/option><option value=\"-30\">-30 dB<\/option><option value=\"-40\">-40 dB<\/option><\/select> Max\n<\/div>\n<div id=\"col1\">\n<select id=\"range_20161207\" onchange='updateFreqRes();'><option value=\"60\">60 dB<\/option><option value=\"80\" selected=\"selected\">80 dB<\/option><option value=\"100\">100 dB<\/option><option value=\"120\">120 dB<\/option><option value=\"140\">140 dB<\/option><option value=\"160\">160 dB<\/option><option value=\"180\">180 dB<\/option><\/select> Range\n<\/div>\n<\/div>\n<div id=\"freqrestable\">\n<div id=\"col2\">\n<em>a<\/em> coefficients (zeros)<br \/>\n<textarea id=\"zeroCoefs_20161207\" rows=\"10\" cols=\"40\" style=\"font-size: 10pt; line-height: 12pt;\"><\/textarea>\n<\/div>\n<div id=\"col2\">\n<em>b<\/em> coefficients (poles)<br \/>\n<textarea id=\"poleCoefs_20161207\" rows=\"10\" cols=\"40\" style=\"font-size: 10pt; line-height: 12pt;\"><\/textarea>\n<\/div>\n<\/div>\n<p>The coefficients fields are tolerant of input format. Most characters that don\u2019t look like numbers are treated as separators. So, you can enter coefficients separated by spaces or commas, or on different lines, separated by returns. That makes it easier to copy and paste coefficients from online filter calculators. They also ignore numbers that are followed by \u201c=\u201d or \u201c =\u201d, so that \u201ca0 = 0.1234\u201d is seen as \u201c0.1234\u201d. Click the chart to accept coefficient changes, or change one of the controls.<\/p>\n<p>Important: This tool does not assume that the filter coefficients are normalized to <em>y<sub>0<\/sub><\/em>. So, in most cases you\u2019ll need to insert a \u201c1\u201d as the first pole coefficient, the <em>b<sub>0<\/sub><\/em> term.<\/p>\n<p>If there are no pole coefficients, it\u2019s an FIR filter\u2014all zeros.<\/p>\n<p>Again, the convention of this website is that coefficients corresponding to zeros (left side of a direct form I) are the <em>a<\/em> coefficients, and poles the <em>b<\/em> coefficients. It\u2019s usually easy to see because most IIR filter calculators normalize the output. So, if you are missing <em>a<sub>0<\/sub><\/em>, it probably means that <em>a<\/em> and <em>b<\/em> are swapped with respect to this site\u2019s convention\u2014just paste them in the opposite coefficients fields (and remember to use a 1 for the missing coefficient). Also, negative signs at the summation for the feedback terms (<em>b<\/em>) are not rolled into the coefficients.<br \/>\n<script type=\"text\/javascript\" src=\"\/scripts\/utils\/flotr2.min.js\"><\/script><script type=\"text\/javascript\" src=\"\/scripts\/utils\/math.min.js\"><\/script><script type=\"text\/javascript\" src=\"\/scripts\/widgets\/20161207\/FreqRes.js\"><\/script><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here\u2019s a tool that plots frequency response from filter coefficients. Hz linearlog 10log 2 Plot auto40 dB30 dB20 dB10 dB0 dB-10 dB-20 dB-30 dB-40 dB Max 60 dB80 dB100 dB120 dB140 dB160 dB180 dB Range a coefficients (zeros) b coefficients &hellip; <a href=\"https:\/\/www.earlevel.com\/main\/2016\/12\/08\/filter-frequency-response-grapher\/\">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,8,19,9,30],"tags":[],"_links":{"self":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/442"}],"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=442"}],"version-history":[{"count":109,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/442\/revisions"}],"predecessor-version":[{"id":963,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/posts\/442\/revisions\/963"}],"wp:attachment":[{"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/media?parent=442"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/categories?post=442"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.earlevel.com\/main\/wp-json\/wp\/v2\/tags?post=442"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}