filters-matlab-bank/index.html

653 lines
24 KiB
HTML
Raw Normal View History

2019-08-17 10:50:06 +02:00
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
2020-10-29 10:09:55 +01:00
<!-- 2020-10-29 jeu. 10:09 -->
2019-08-17 10:50:06 +02:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>List of filters - Matlab Implementation</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<link rel="stylesheet" type="text/css" href="./css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="./css/readtheorg.css"/>
<link rel="stylesheet" type="text/css" href="./css/zenburn.css"/>
<script type="text/javascript" src="./js/jquery.min.js"></script>
<script type="text/javascript" src="./js/bootstrap.min.js"></script>
<script type="text/javascript" src="./js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="./js/readtheorg.js"></script>
2020-10-26 14:04:35 +01:00
<script>MathJax = {
tex: {
tags: 'ams',
macros: {bm: ["\\boldsymbol{#1}",1],}
}
};
</script>
<script type="text/javascript" src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
2019-08-17 10:50:06 +02:00
</head>
<body>
<div id="org-div-home-and-up">
2020-10-29 10:09:55 +01:00
<a accesskey="h" href="../index.html"> UP </a>
2019-08-17 10:50:06 +02:00
|
2020-10-29 10:09:55 +01:00
<a accesskey="H" href="../index.html"> HOME </a>
2019-08-17 10:50:06 +02:00
</div><div id="content">
<h1 class="title">List of filters - Matlab Implementation</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#org580fffb">1. Low Pass</a>
2019-08-17 10:50:06 +02:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#org407f734">1.1. First Order Low Pass Filter</a></li>
<li><a href="#org2414a25">1.2. Second Order</a></li>
<li><a href="#orgfb40d54">1.3. Combine multiple first order filters</a></li>
2019-08-17 10:50:06 +02:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#org7d2ccd5">2. High Pass</a>
2019-08-17 10:50:06 +02:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#orgcb3470e">2.1. First Order</a></li>
<li><a href="#orgeaaee1d">2.2. Second Order</a></li>
<li><a href="#org7f499ff">2.3. Combine multiple filters</a></li>
2019-08-17 10:50:06 +02:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#org5678356">3. Band Pass</a>
2019-08-17 10:50:06 +02:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#org8717dd0">3.1. Second Order</a></li>
2020-10-26 09:43:09 +01:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#org5e9ca85">4. Notch</a>
2020-10-26 09:43:09 +01:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#org768f6c2">4.1. Second Order</a></li>
2020-10-26 09:43:09 +01:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#orge2713ac">5. Chebyshev</a>
2020-10-26 09:43:09 +01:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#org171db68">5.1. Chebyshev Type I</a></li>
2020-10-26 09:43:09 +01:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#org22f67c7">6. Lead - Lag</a>
2020-10-26 09:43:09 +01:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#org15c6b6a">6.1. Lead</a></li>
<li><a href="#org1c67cbf">6.2. Lag</a></li>
2020-10-26 14:04:35 +01:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#org5824a84">7. Complementary</a></li>
<li><a href="#org738f16d">8. Performance Weight</a>
2020-10-26 14:04:35 +01:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#orgaa274fe">8.1. Nice combination</a></li>
<li><a href="#org9c5eb04">8.2. Alternative</a></li>
2020-10-26 14:04:35 +01:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#org0c47683">9. Combine Filters</a>
2020-10-26 14:04:35 +01:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#org61b1c81">9.1. Additive</a></li>
<li><a href="#orgeef5af6">9.2. Multiplicative</a></li>
2020-10-26 14:04:35 +01:00
</ul>
</li>
2020-10-29 10:09:55 +01:00
<li><a href="#org011f201">10. Filters representing noise</a>
2020-10-26 14:04:35 +01:00
<ul>
2020-10-29 10:09:55 +01:00
<li><a href="#orgd4fd858">10.1. First Order Low Pass Filter</a></li>
2019-08-17 10:50:06 +02:00
</ul>
</li>
</ul>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org580fffb" class="outline-2">
<h2 id="org580fffb"><span class="section-number-2">1</span> Low Pass</h2>
2019-08-17 10:50:06 +02:00
<div class="outline-text-2" id="text-1">
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org407f734" class="outline-3">
<h3 id="org407f734"><span class="section-number-3">1.1</span> First Order Low Pass Filter</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-1-1">
<p>
\[ H(s) = \frac{1}{1 + s/\omega_0} \]
</p>
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
<p>
Parameters:
</p>
<ul class="org-ul">
<li>\(\omega_0\): cut-off frequency in [rad/s]</li>
</ul>
2020-10-26 09:43:09 +01:00
2019-08-17 10:50:06 +02:00
<p>
2020-10-26 14:04:35 +01:00
Characteristics:
2019-08-17 10:50:06 +02:00
</p>
2020-10-26 14:04:35 +01:00
<ul class="org-ul">
<li>Low frequency gain of \(1\)</li>
<li>Roll-off equals to -20 dB/dec</li>
</ul>
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
<p>
Matlab code:
</p>
2019-08-17 10:50:06 +02:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% Cut-off Frequency [rad/s]</span>
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
H = 1<span class="org-type">/</span>(1 <span class="org-type">+</span> s<span class="org-type">/</span>w0);
2019-08-17 10:50:06 +02:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="org47108f3" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_low_pass_first_order.png" alt="filter_low_pass_first_order.png" />
2019-08-17 10:50:06 +02:00
</p>
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org2414a25" class="outline-3">
<h3 id="org2414a25"><span class="section-number-3">1.2</span> Second Order</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-1-2">
2019-08-17 10:50:06 +02:00
<p>
\[ H(s) = \frac{1}{1 + 2 \xi / \omega_0 s + s^2/\omega_0^2} \]
</p>
2020-10-26 14:04:35 +01:00
<p>
Parameters:
</p>
<ul class="org-ul">
<li>\(\omega_0\):</li>
<li>\(\xi\): Damping ratio</li>
</ul>
<p>
Characteristics:
</p>
<ul class="org-ul">
<li>Low frequency gain: 1</li>
<li>High frequency roll off: - 40 dB/dec</li>
</ul>
<p>
Matlab code:
</p>
2019-08-17 10:50:06 +02:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% Cut-off frequency [rad/s]</span>
xi = 0.3; <span class="org-comment">% Damping Ratio</span>
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
H = 1<span class="org-type">/</span>(1 <span class="org-type">+</span> 2<span class="org-type">*</span>xi<span class="org-type">/</span>w0<span class="org-type">*</span>s <span class="org-type">+</span> s<span class="org-type">^</span>2<span class="org-type">/</span>w0<span class="org-type">^</span>2);
2019-08-17 10:50:06 +02:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="org7ef70c6" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_low_pass_second_order.png" alt="filter_low_pass_second_order.png" />
2019-08-17 10:50:06 +02:00
</p>
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-orgfb40d54" class="outline-3">
<h3 id="orgfb40d54"><span class="section-number-3">1.3</span> Combine multiple first order filters</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-1-3">
2019-08-17 10:50:06 +02:00
<p>
\[ H(s) = \left( \frac{1}{1 + s/\omega_0} \right)^n \]
</p>
2020-10-26 14:04:35 +01:00
<p>
Matlab code:
</p>
2019-08-17 10:50:06 +02:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% Cut-off frequency [rad/s]</span>
n = 3; <span class="org-comment">% Filter order</span>
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
H = (1<span class="org-type">/</span>(1 <span class="org-type">+</span> s<span class="org-type">/</span>w0))<span class="org-type">^</span>n;
2019-08-17 10:50:06 +02:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="org5facb77" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_low_pass_first_order_add.png" alt="filter_low_pass_first_order_add.png" />
2019-08-17 10:50:06 +02:00
</p>
</div>
2020-10-26 09:43:09 +01:00
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org7d2ccd5" class="outline-2">
<h2 id="org7d2ccd5"><span class="section-number-2">2</span> High Pass</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-2">
2020-10-26 09:43:09 +01:00
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-orgcb3470e" class="outline-3">
<h3 id="orgcb3470e"><span class="section-number-3">2.1</span> First Order</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-2-1">
2019-08-17 10:50:06 +02:00
<p>
\[ H(s) = \frac{s/\omega_0}{1 + s/\omega_0} \]
</p>
2020-10-26 14:04:35 +01:00
<p>
Parameters:
</p>
<ul class="org-ul">
<li>\(\omega_0\): cut-off frequency in [rad/s]</li>
</ul>
<p>
Characteristics:
</p>
<ul class="org-ul">
<li>High frequency gain of \(1\)</li>
<li>Low frequency slow of +20 dB/dec</li>
</ul>
<p>
Matlab code:
</p>
2019-08-17 10:50:06 +02:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% Cut-off frequency [rad/s]</span>
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
H = (s<span class="org-type">/</span>w0)<span class="org-type">/</span>(1 <span class="org-type">+</span> s<span class="org-type">/</span>w0);
2019-08-17 10:50:06 +02:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="orge0525b5" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_high_pass_first_order.png" alt="filter_high_pass_first_order.png" />
2019-08-17 10:50:06 +02:00
</p>
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-orgeaaee1d" class="outline-3">
<h3 id="orgeaaee1d"><span class="section-number-3">2.2</span> Second Order</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-2-2">
2019-08-17 10:50:06 +02:00
<p>
\[ H(s) = \frac{s^2/\omega_0^2}{1 + 2 \xi / \omega_0 s + s^2/\omega_0^2} \]
</p>
2020-10-26 14:04:35 +01:00
<p>
Parameters:
</p>
<ul class="org-ul">
<li>\(\omega_0\):</li>
<li>\(\xi\): Damping ratio</li>
</ul>
<p>
Matlab code:
</p>
2019-08-17 10:50:06 +02:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% [rad/s]</span>
xi = 0.3;
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
H = (s<span class="org-type">^</span>2<span class="org-type">/</span>w0<span class="org-type">^</span>2)<span class="org-type">/</span>(1 <span class="org-type">+</span> 2<span class="org-type">*</span>xi<span class="org-type">/</span>w0<span class="org-type">*</span>s <span class="org-type">+</span> s<span class="org-type">^</span>2<span class="org-type">/</span>w0<span class="org-type">^</span>2);
2019-08-17 10:50:06 +02:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="org3651b21" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_high_pass_second_order.png" alt="filter_high_pass_second_order.png" />
2019-08-17 10:50:06 +02:00
</p>
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org7f499ff" class="outline-3">
<h3 id="org7f499ff"><span class="section-number-3">2.3</span> Combine multiple filters</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-2-3">
2019-08-17 10:50:06 +02:00
<p>
\[ H(s) = \left( \frac{s/\omega_0}{1 + s/\omega_0} \right)^n \]
</p>
2020-10-26 14:04:35 +01:00
<p>
Matlab code:
</p>
2019-08-17 10:50:06 +02:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% [rad/s]</span>
n = 3;
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
H = ((s<span class="org-type">/</span>w0)<span class="org-type">/</span>(1 <span class="org-type">+</span> s<span class="org-type">/</span>w0))<span class="org-type">^</span>n;
2019-08-17 10:50:06 +02:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="org6f8e2de" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_high_pass_first_order_add.png" alt="filter_high_pass_first_order_add.png" />
2019-08-17 10:50:06 +02:00
</p>
</div>
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org5678356" class="outline-2">
<h2 id="org5678356"><span class="section-number-2">3</span> Band Pass</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-3">
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org8717dd0" class="outline-3">
<h3 id="org8717dd0"><span class="section-number-3">3.1</span> Second Order</h3>
2020-10-26 14:04:35 +01:00
</div>
2020-10-26 09:43:09 +01:00
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org5e9ca85" class="outline-2">
<h2 id="org5e9ca85"><span class="section-number-2">4</span> Notch</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-4">
2019-08-17 10:50:06 +02:00
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org768f6c2" class="outline-3">
<h3 id="org768f6c2"><span class="section-number-3">4.1</span> Second Order</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-4-1">
\begin{equation}
\frac{s^2 + 2 g_c \xi \omega_n s + \omega_n^2}{s^2 + 2 \xi \omega_n s + \omega_n^2}
\end{equation}
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
<p>
Parameters:
</p>
<ul class="org-ul">
<li>\(\omega_n\): frequency of the notch</li>
<li>\(g_c\): gain at the notch frequency</li>
<li>\(\xi\): damping ratio (notch width)</li>
</ul>
<p>
Matlab code:
</p>
2020-10-26 09:43:09 +01:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">gc = 0.02;
xi = 0.1;
wn = 2<span class="org-type">*</span><span class="org-constant">pi</span>;
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
H = (s<span class="org-type">^</span>2 <span class="org-type">+</span> 2<span class="org-type">*</span>gm<span class="org-type">*</span>xi<span class="org-type">*</span>wn<span class="org-type">*</span>s <span class="org-type">+</span> wn<span class="org-type">^</span>2)<span class="org-type">/</span>(s<span class="org-type">^</span>2 <span class="org-type">+</span> 2<span class="org-type">*</span>xi<span class="org-type">*</span>wn<span class="org-type">*</span>s <span class="org-type">+</span> wn<span class="org-type">^</span>2);
2020-10-26 09:43:09 +01:00
</pre>
</div>
2019-08-17 10:50:06 +02:00
2020-10-26 09:43:09 +01:00
2020-10-29 10:09:55 +01:00
<div id="org4faffaa" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_notch_xi.png" alt="filter_notch_xi.png" />
</p>
2019-08-17 10:50:06 +02:00
</div>
2020-10-26 14:04:35 +01:00
2020-10-29 10:09:55 +01:00
<div id="org1272339" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_notch_gc.png" alt="filter_notch_gc.png" />
</p>
</div>
</div>
</div>
2019-08-17 10:50:06 +02:00
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-orge2713ac" class="outline-2">
<h2 id="orge2713ac"><span class="section-number-2">5</span> Chebyshev</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-5">
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org171db68" class="outline-3">
<h3 id="org171db68"><span class="section-number-3">5.1</span> Chebyshev Type I</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-5-1">
<div class="org-src-container">
<pre class="src src-matlab">n = 4; <span class="org-comment">% Order of the filter</span>
Rp = 3; <span class="org-comment">% Maximum peak-to-peak ripple [dB]</span>
Wp = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% passband-edge frequency [rad/s]</span>
2019-08-17 10:50:06 +02:00
2020-10-26 14:04:35 +01:00
[A,B,C,D] = cheby1(n, Rp, Wp, <span class="org-string">'high'</span>, <span class="org-string">'s'</span>);
H = ss(A, B, C, D);
</pre>
2019-08-17 10:50:06 +02:00
</div>
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org22f67c7" class="outline-2">
<h2 id="org22f67c7"><span class="section-number-2">6</span> Lead - Lag</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-6">
2020-10-26 09:43:09 +01:00
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org15c6b6a" class="outline-3">
<h3 id="org15c6b6a"><span class="section-number-3">6.1</span> Lead</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-6-1">
\begin{equation}
H(s) = \frac{1 + \frac{s}{w_c/\sqrt{a}}}{1 + \frac{s}{w_c \sqrt{a}}}, \quad a > 1
\end{equation}
2020-10-26 09:43:09 +01:00
<p>
2020-10-26 14:04:35 +01:00
Parameters:
2020-10-26 09:43:09 +01:00
</p>
2020-10-26 14:04:35 +01:00
<ul class="org-ul">
<li>\(\omega_c\): frequency at which the phase lead is maximum</li>
<li>\(a\): parameter to adjust the phase lead, also impacts the high frequency gain</li>
</ul>
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
<p>
Characteristics:
</p>
2020-10-26 09:43:09 +01:00
<ul class="org-ul">
2020-10-26 14:04:35 +01:00
<li>the low frequency gain is \(1\)</li>
<li>the high frequency gain is \(a\)</li>
2020-10-29 10:09:55 +01:00
<li>the phase lead at \(\omega_c\) is equal to (Figure <a href="#org35d4f5a">10</a>):
2020-10-26 14:04:35 +01:00
\[ \angle H(j\omega_c) = \tan^{-1}(\sqrt{a}) - \tan^{-1}(1/\sqrt{a}) \]</li>
2020-10-26 09:43:09 +01:00
</ul>
2020-10-26 14:04:35 +01:00
<p>
Matlab code:
</p>
2020-10-26 09:43:09 +01:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">a = 0.6; <span class="org-comment">% Amount of phase lead / width of the phase lead / high frequency gain</span>
wc = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% Frequency with the maximum phase lead [rad/s]</span>
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
H = (1 <span class="org-type">+</span> s<span class="org-type">/</span>(wc<span class="org-type">/</span>sqrt(a)))<span class="org-type">/</span>(1 <span class="org-type">+</span> s<span class="org-type">/</span>(wc<span class="org-type">*</span>sqrt(a)));
2020-10-26 09:43:09 +01:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="orgdc2e657" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_lead.png" alt="filter_lead.png" />
</p>
</div>
2020-10-29 10:09:55 +01:00
<div id="org35d4f5a" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_lead_effect_a_phase.png" alt="filter_lead_effect_a_phase.png" />
2020-10-26 09:43:09 +01:00
</p>
</div>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org1c67cbf" class="outline-3">
<h3 id="org1c67cbf"><span class="section-number-3">6.2</span> Lag</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-6-2">
\begin{equation}
H(s) = \frac{w_c \sqrt{a} + s}{\frac{w_c}{\sqrt{a}} + s}, \quad a > 1
\end{equation}
2020-10-26 09:43:09 +01:00
<p>
2020-10-26 14:04:35 +01:00
Parameters:
2020-10-26 09:43:09 +01:00
</p>
2020-10-26 14:04:35 +01:00
<ul class="org-ul">
<li>\(\omega_c\): frequency at which the phase lag is maximum</li>
<li>\(a\): parameter to adjust the phase lag, also impacts the low frequency gain</li>
</ul>
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
<p>
Characteristics:
</p>
2020-10-26 09:43:09 +01:00
<ul class="org-ul">
2020-10-26 14:04:35 +01:00
<li>the low frequency gain is increased by a factor \(a\)</li>
<li>the high frequency gain is \(1\) (unchanged)</li>
2020-10-29 10:09:55 +01:00
<li>the phase lag at \(\omega_c\) is equal to (Figure <a href="#org013fbcc">12</a>):
2020-10-26 14:04:35 +01:00
\[ \angle H(j\omega_c) = \tan^{-1}(1/\sqrt{a}) - \tan^{-1}(\sqrt{a}) \]</li>
2020-10-26 09:43:09 +01:00
</ul>
2020-10-26 14:04:35 +01:00
<p>
Matlab code:
</p>
2020-10-26 09:43:09 +01:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">a = 0.6; <span class="org-comment">% Amount of phase lag / width of the phase lag / high frequency gain</span>
wc = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% Frequency with the maximum phase lag [rad/s]</span>
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
H = (wc<span class="org-type">*</span>sqrt(a) <span class="org-type">+</span> s)<span class="org-type">/</span>(wc<span class="org-type">/</span>sqrt(a) <span class="org-type">+</span> s);
2020-10-26 09:43:09 +01:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="org7dff5fa" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_lag.png" alt="filter_lag.png" />
2020-10-26 09:43:09 +01:00
</p>
</div>
2020-10-26 14:04:35 +01:00
2020-10-29 10:09:55 +01:00
<div id="org013fbcc" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_lag_effect_a_phase.png" alt="filter_lag_effect_a_phase.png" />
2020-10-26 09:43:09 +01:00
</p>
2020-10-26 14:04:35 +01:00
</div>
</div>
</div>
</div>
2020-10-26 09:43:09 +01:00
2020-10-29 10:09:55 +01:00
<div id="outline-container-org5824a84" class="outline-2">
<h2 id="org5824a84"><span class="section-number-2">7</span> Complementary</h2>
2020-10-26 14:04:35 +01:00
</div>
2020-10-26 09:43:09 +01:00
2020-10-29 10:09:55 +01:00
<div id="outline-container-org738f16d" class="outline-2">
<h2 id="org738f16d"><span class="section-number-2">8</span> Performance Weight</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-8">
2020-10-26 09:43:09 +01:00
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-orgaa274fe" class="outline-3">
<h3 id="orgaa274fe"><span class="section-number-3">8.1</span> Nice combination</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-8-1">
\begin{equation}
W(s) = G_c * \left(\frac{\frac{1}{\omega_0}\sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{G_0}{G_c}\right)^{\frac{1}{n}}}{\frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{\left(\frac{G_\infty}{G_c}\right)^{\frac{2}{n}} - 1}} s + 1}\right)^n
\end{equation}
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
<div class="org-src-container">
<pre class="src src-matlab">n = 2; w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>11; G0 = 1<span class="org-type">/</span>10; G1 = 1000; Gc = 1<span class="org-type">/</span>2;
wL = Gc<span class="org-type">*</span>(((G1<span class="org-type">/</span>Gc)<span class="org-type">^</span>(1<span class="org-type">/</span>n)<span class="org-type">/</span>w0<span class="org-type">*</span>sqrt((1<span class="org-type">-</span>(G0<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n))<span class="org-type">/</span>((G1<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n)<span class="org-type">-</span>1))<span class="org-type">*</span>s <span class="org-type">+</span> (G0<span class="org-type">/</span>Gc)<span class="org-type">^</span>(1<span class="org-type">/</span>n))<span class="org-type">/</span>(1<span class="org-type">/</span>w0<span class="org-type">*</span>sqrt((1<span class="org-type">-</span>(G0<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n))<span class="org-type">/</span>((G1<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n)<span class="org-type">-</span>1))<span class="org-type">*</span>s <span class="org-type">+</span> 1))<span class="org-type">^</span>n;
n = 3; w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>9; G0 = 10000; G1 = 0.1; Gc = 1<span class="org-type">/</span>2;
wH = Gc<span class="org-type">*</span>(((G1<span class="org-type">/</span>Gc)<span class="org-type">^</span>(1<span class="org-type">/</span>n)<span class="org-type">/</span>w0<span class="org-type">*</span>sqrt((1<span class="org-type">-</span>(G0<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n))<span class="org-type">/</span>((G1<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n)<span class="org-type">-</span>1))<span class="org-type">*</span>s <span class="org-type">+</span> (G0<span class="org-type">/</span>Gc)<span class="org-type">^</span>(1<span class="org-type">/</span>n))<span class="org-type">/</span>(1<span class="org-type">/</span>w0<span class="org-type">*</span>sqrt((1<span class="org-type">-</span>(G0<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n))<span class="org-type">/</span>((G1<span class="org-type">/</span>Gc)<span class="org-type">^</span>(2<span class="org-type">/</span>n)<span class="org-type">-</span>1))<span class="org-type">*</span>s <span class="org-type">+</span> 1))<span class="org-type">^</span>n;
</pre>
2020-10-26 09:43:09 +01:00
</div>
</div>
</div>
2020-10-26 14:04:35 +01:00
2020-10-29 10:09:55 +01:00
<div id="outline-container-org9c5eb04" class="outline-3">
<h3 id="org9c5eb04"><span class="section-number-3">8.2</span> Alternative</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-8-2">
2020-10-26 09:43:09 +01:00
<div class="org-src-container">
2020-10-26 14:04:35 +01:00
<pre class="src src-matlab">w0 = 2<span class="org-type">*</span><span class="org-constant">pi</span>; <span class="org-comment">% [rad/s]</span>
A = 1e<span class="org-type">-</span>2;
M = 5;
2020-10-26 09:43:09 +01:00
2020-10-26 14:04:35 +01:00
H = (s<span class="org-type">/</span>sqrt(M) <span class="org-type">+</span> w0)<span class="org-type">^</span>2<span class="org-type">/</span>(s <span class="org-type">+</span> w0<span class="org-type">*</span>sqrt(A))<span class="org-type">^</span>2;
2020-10-26 09:43:09 +01:00
</pre>
</div>
2020-10-29 10:09:55 +01:00
<div id="org67210d5" class="figure">
2020-10-26 09:43:09 +01:00
<p><img src="figs/weight_first_order.png" alt="weight_first_order.png" />
</p>
</div>
</div>
</div>
2020-10-26 14:04:35 +01:00
</div>
2020-10-26 09:43:09 +01:00
2020-10-29 10:09:55 +01:00
<div id="outline-container-org0c47683" class="outline-2">
<h2 id="org0c47683"><span class="section-number-2">9</span> Combine Filters</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-9">
2020-10-26 09:43:09 +01:00
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org61b1c81" class="outline-3">
<h3 id="org61b1c81"><span class="section-number-3">9.1</span> Additive</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-9-1">
2020-10-26 09:43:09 +01:00
<ul class="org-ul">
<li class="off"><code>[&#xa0;]</code> Explain how phase and magnitude combine</li>
</ul>
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-orgeef5af6" class="outline-3">
<h3 id="orgeef5af6"><span class="section-number-3">9.2</span> Multiplicative</h3>
2020-10-26 14:04:35 +01:00
</div>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-org011f201" class="outline-2">
<h2 id="org011f201"><span class="section-number-2">10</span> Filters representing noise</h2>
2020-10-26 14:04:35 +01:00
<div class="outline-text-2" id="text-10">
<p>
Let&rsquo;s consider a noise \(n\) that is shaped from a white-noise \(\tilde{n}\) with unitary PSD (\(\Phi_\tilde{n}(\omega) = 1\)) using a transfer function \(G(s)\).
The PSD of \(n\) is then:
\[ \Phi_n(\omega) = |G(j\omega)|^2 \Phi_{\tilde{n}}(\omega) = |G(j\omega)|^2 \]
</p>
<p>
The PSD \(\Phi_n(\omega)\) is expressed in \(\text{unit}^2/\text{Hz}\).
</p>
<p>
And the root mean square (RMS) of \(n(t)\) is:
\[ \sigma_n = \sqrt{\int_{0}^{\infty} \Phi_n(\omega) d\omega} \]
</p>
</div>
2020-10-29 10:09:55 +01:00
<div id="outline-container-orgd4fd858" class="outline-3">
<h3 id="orgd4fd858"><span class="section-number-3">10.1</span> First Order Low Pass Filter</h3>
2020-10-26 14:04:35 +01:00
<div class="outline-text-3" id="text-10-1">
<p>
\[ G(s) = \frac{g_0}{1 + \frac{s}{\omega_c}} \]
</p>
<div class="org-src-container">
<pre class="src src-matlab">g0 = 1; <span class="org-comment">% Noise Density in unit/sqrt(Hz)</span>
wc = 1; <span class="org-comment">% Cut-Off frequency [rad/s]</span>
G = g0<span class="org-type">/</span>(1 <span class="org-type">+</span> s<span class="org-type">/</span>wc);
<span class="org-comment">% Frequency vector [Hz]</span>
freqs = logspace(<span class="org-type">-</span>3, 3, 1000);
<span class="org-comment">% </span><span class="org-comment"><span class="org-constant">PSD </span></span><span class="org-comment">of n in [unit^2/Hz]</span>
Phi_n = abs(squeeze(freqresp(G, freqs, <span class="org-string">'Hz'</span>)))<span class="org-type">.^</span>2;
<span class="org-comment">% </span><span class="org-comment"><span class="org-constant">RMS </span></span><span class="org-comment">value of n in [unit, rms]</span>
sigma_n = sqrt(trapz(freqs, Phi_n))
</pre>
</div>
<p>
\[ \sigma = \frac{1}{2} g_0 \sqrt{\omega_c} \]
with:
</p>
<ul class="org-ul">
<li>\(g_0\) the Noise Density of \(n\) in \(\text{unit}/\sqrt{Hz}\)</li>
<li>\(\omega_c\) the bandwidth over which the noise is located, in rad/s</li>
<li>\(\sigma\) the rms noise</li>
</ul>
<p>
If the cut-off frequency is to be expressed in Hz:
\[ \sigma = \frac{1}{2} g_0 \sqrt{2\pi f_c} = \sqrt{\frac{\pi}{2}} g_0 \sqrt{f_c} \]
</p>
<p>
Thus, if a sensor is said to have a RMS noise of \(\sigma = 10 nm\ rms\) over a bandwidth of \(\omega_c = 100 rad/s\), we can estimated the noise density of the sensor to be (supposing a first order low pass filter noise shape):
\[ g_0 = \frac{2 \sigma}{\sqrt{\omega_c}} \quad \left[ m/\sqrt{Hz} \right] \]
</p>
<div class="org-src-container">
<pre class="src src-matlab">2<span class="org-type">*</span>10e<span class="org-type">-</span>9<span class="org-type">/</span>sqrt(100)
</pre>
</div>
<pre class="example">
2e-09
</pre>
<div class="org-src-container">
<pre class="src src-matlab">6<span class="org-type">*</span>0.5<span class="org-type">*</span>20e<span class="org-type">-</span>12<span class="org-type">*</span>sqrt(2<span class="org-type">*</span><span class="org-constant">pi</span><span class="org-type">*</span>100)
</pre>
</div>
<pre class="example">
1.504e-09
</pre>
</div>
2020-10-26 09:43:09 +01:00
</div>
2019-08-17 10:50:06 +02:00
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
2020-10-29 10:09:55 +01:00
<p class="date">Created: 2020-10-29 jeu. 10:09</p>
2019-08-17 10:50:06 +02:00
</div>
</body>
</html>