<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Le 25/07/2022 à 02:44, Federico Miyara
a écrit :<br>
</div>
<blockquote type="cite"
cite="mid:8384eff2-75e0-ed6b-6bf4-31e02d072c88@fceia.unr.edu.ar">
<br>
<font face="Courier New">Samuel,</font><br>
<br>
<blockquote type="cite"
cite="mid:ab405210-2987-25d4-df5e-fbbd92b6d5ac@free.fr">Sorry,
but nothing is clear to me about your statements:<br>
<br>
1) what shows you that iir() is correct while the analpf +
horner way is not?<br>
</blockquote>
<br>
There are several reasons: <br>
<br>
a) The result of using iir() is consistent with the expected
frequency response, since it is equal to the analog filter
response except at high frequency, an expected artifact for IIR
filters. The other solution is completely different.<br>
<br>
b) The degree of the denominator should be 6 but when using horner
it reduces to 3.<br>
<br>
My own informal and not very deep analysis suggests that as all
the poles are very close to unity, may be horner() performs some
simplification and simplifies things incorrectly, which might
dramatically change the frequency response. <br>
<br>
<blockquote type="cite"
cite="mid:ab405210-2987-25d4-df5e-fbbd92b6d5ac@free.fr"> 2) With
the analpf + horner method, assuming that it is not correct,
what shows you that horner is not correct, while analpf is
correct, instead of the opposite or both incorrect?<br>
</blockquote>
<br>
analpf() is a very simple algorithm, at least for Butterworth,
since explicit formulas for the poles exist and in all the cases I
have tested the result is the expected one, particularly in this
case. <br>
<br>
<blockquote type="cite"
cite="mid:ab405210-2987-25d4-df5e-fbbd92b6d5ac@free.fr"> 3) do
you have a reference about the equivalence?<br>
</blockquote>
<br>
The substitution of the bilinear transformation is the usual
method to get an IIR digital filter from an analog prototype. They
aren't completely equivalent, but very similar up to about half
Nyquist frequency. Any book on digital signal processing includes
that transformation. Also <a class="moz-txt-link-freetext"
href="https://en.wikipedia.org/wiki/Bilinear_transform">https://en.wikipedia.org/wiki/Bilinear_transform</a><br>
<br>
<blockquote type="cite"
cite="mid:ab405210-2987-25d4-df5e-fbbd92b6d5ac@free.fr"> 4) have
you tried after simp_mode(%f)?<br>
</blockquote>
<br>
No, but this might be the answer considering my reply to 2). I'll
try it later.<br>
</blockquote>
<p><br>
</p>
<p>To get equivalent transfer functions, you need<br>
a) indeed to turn simp_mode(%f),<br>
b) to run <span style="color:rgb(0,0,0);"><br>
<font face="monospace">hBPz1</font></span><font face="monospace">
<span style="color:rgb(92,92,92);">=</span> <span
style="color:rgb(0,0,0);">iir</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(188,143,143);">3</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(188,143,143);">bp</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(188,143,143);">butt</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(0,0,0);">fo</span><span
style="color:rgb(92,92,92);">/</span><span
style="color:rgb(0,0,0);">Fs</span><span
style="color:rgb(92,92,92);">*</span><span
style="color:rgb(74,85,219);">[</span><span
style="color:rgb(0,0,0);"></span><span
style="color:rgb(188,143,143);">2</span><span
style="color:rgb(92,92,92);">^</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(92,92,92);">-</span><span
style="color:rgb(188,143,143);">1</span><span
style="color:rgb(92,92,92);">/</span><span
style="color:rgb(188,143,143);">6</span><span
style="color:rgb(74,85,219);">), </span><span
style="color:rgb(188,143,143);">2</span><span
style="color:rgb(92,92,92);">^</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(188,143,143);">1</span><span
style="color:rgb(92,92,92);">/</span><span
style="color:rgb(188,143,143);">6</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(0,0,0);"></span><span
style="color:rgb(74,85,219);"></span><span
style="color:rgb(74,85,219);">]</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(74,85,219);">[</span><span
style="color:rgb(188,143,143);">0</span> <span
style="color:rgb(188,143,143);">0</span><span
style="color:rgb(74,85,219);">]</span></font><span
style="color:rgb(74,85,219);"><font face="monospace">)<br>
</font>instead of</span><span style="color:rgb(0,0,0);"><br>
<font face="monospace">hBPz1</font></span><font face="monospace">
<span style="color:rgb(92,92,92);">=</span> <span
style="color:rgb(0,0,0);">iir</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(188,143,143);">3</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(188,143,143);">bp</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(188,143,143);">butt</span><span
style="color:rgb(188,143,143);">"</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(0,0,0);">fo</span><span
style="color:rgb(92,92,92);">/</span><span
style="color:rgb(0,0,0);">Fs</span><span
style="color:rgb(92,92,92);">*</span><span
style="color:rgb(74,85,219);">[</span><span
style="color:rgb(188,143,143);">2</span><span
style="color:rgb(92,92,92);">^</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(188,143,143);">1</span><span
style="color:rgb(92,92,92);">/</span><span
style="color:rgb(188,143,143);">6</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(0,0,0);">,</span><span
style="color:rgb(188,143,143);">2</span><span
style="color:rgb(92,92,92);">^</span><span
style="color:rgb(74,85,219);">(</span><span
style="color:rgb(92,92,92);">-</span><span
style="color:rgb(188,143,143);">1</span><span
style="color:rgb(92,92,92);">/</span><span
style="color:rgb(188,143,143);">6</span><span
style="color:rgb(74,85,219);">)</span><span
style="color:rgb(74,85,219);">]</span><span
style="color:rgb(0,0,0);">,</span> <span
style="color:rgb(74,85,219);">[</span><span
style="color:rgb(188,143,143);">0</span> <span
style="color:rgb(188,143,143);">0</span><span
style="color:rgb(74,85,219);">]</span><span
style="color:rgb(74,85,219);">)</span></font></p>
<p>Then the curves of both transfer functions are superimposed.<br>
</p>
<pre style="font-family:Monospaced;font-style:normal;font-size:12.0;"><span style="color:rgb(174,92,176);text-decoration:underline;">clf</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(174,92,176);text-decoration:underline;">plot</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);"></span><span style="color:rgb(188,143,143);"></span><span style="color:rgb(188,143,143);"></span><span style="color:rgb(0,0,0);"></span><span style="color:rgb(50,185,185);">linspace</span><span style="color:rgb(74,85,219);">(</span><span style="color:rgb(188,143,143);">0.5</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">1.5</span><span style="color:rgb(0,0,0);">,</span><span style="color:rgb(188,143,143);">100</span><span style="color:rgb(74,85,219);">)</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(74,85,219);">[</span><span style="color:rgb(0,0,0);">hBPsz</span><span style="color:rgb(0,0,0);">,</span> <span style="color:rgb(0,0,0);">hBPz1</span><span style="color:rgb(74,85,219);">]</span><span style="color:rgb(74,85,219);">)
<font color="#000000">When working with polynomials or rationals, one must keep in mind that every time that their roots or/and poles have close values,
then results become very sensitive to numerical round-off errors or uncertainties.
The roots of a polynomial of degree N can't be computed from its coefficients with a numerical relative accuracy better than %eps^(1/N).
If this uncertainty becomes bigger than the distance between roots values, then things become really bad.
</font></span>
Samuel
</pre>
<br>
</body>
</html>