filters-matlab-bank/index.html

648 lines
24 KiB
HTML
Raw Permalink 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-11-12 10:35:54 +01:00
<!-- 2020-11-12 jeu. 10:35 -->
2019-08-17 10:50:06 +02:00
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
2020-11-12 10:35:54 +01:00
<title>Bank of Linear Filters - Matlab</title>
2019-08-17 10:50:06 +02:00
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
2020-11-12 10:35:54 +01:00
<link rel="stylesheet" type="text/css" href="https://research.tdehaeze.xyz/css/style.css"/>
<script type="text/javascript" src="https://research.tdehaeze.xyz/js/script.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">
2020-11-12 10:35:54 +01:00
<h1 class="title">Bank of Linear Filters - Matlab</h1>
2019-08-17 10:50:06 +02:00
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#org90266e3">1. Low Pass</a>
2019-08-17 10:50:06 +02:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#org4291475">1.1. First Order Low Pass Filter</a></li>
<li><a href="#org88f266d">1.2. Second Order</a></li>
<li><a href="#org1ee2123">1.3. Combine multiple first order filters</a></li>
2019-08-17 10:50:06 +02:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#orgd7f4531">2. High Pass</a>
2019-08-17 10:50:06 +02:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#org5859621">2.1. First Order</a></li>
<li><a href="#org988fb36">2.2. Second Order</a></li>
<li><a href="#orgd1ae949">2.3. Combine multiple filters</a></li>
2019-08-17 10:50:06 +02:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#org0871964">3. Band Pass</a>
2019-08-17 10:50:06 +02:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#org020bd3f">3.1. Second Order</a></li>
2020-10-26 09:43:09 +01:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#org226333f">4. Notch</a>
2020-10-26 09:43:09 +01:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#org5d6517b">4.1. Second Order</a></li>
2020-10-26 09:43:09 +01:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#orgff2aff5">5. Chebyshev</a>
2020-10-26 09:43:09 +01:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#orgb7b715f">5.1. Chebyshev Type I</a></li>
2020-10-26 09:43:09 +01:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#orge46a59c">6. Lead - Lag</a>
2020-10-26 09:43:09 +01:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#org6336fc3">6.1. Lead</a></li>
<li><a href="#org3797972">6.2. Lag</a></li>
2020-10-26 14:04:35 +01:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#org5e67a97">7. Complementary</a></li>
<li><a href="#org74fba97">8. Performance Weight</a>
2020-10-26 14:04:35 +01:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#org64d3111">8.1. Nice combination</a></li>
<li><a href="#org978d37b">8.2. Alternative</a></li>
2020-10-26 14:04:35 +01:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#org043cd0b">9. Combine Filters</a>
2020-10-26 14:04:35 +01:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#orgbb8d210">9.1. Additive</a></li>
<li><a href="#orgc6eac8f">9.2. Multiplicative</a></li>
2020-10-26 14:04:35 +01:00
</ul>
</li>
2020-11-12 10:35:54 +01:00
<li><a href="#org2616858">10. Filters representing noise</a>
2020-10-26 14:04:35 +01:00
<ul>
2020-11-12 10:35:54 +01:00
<li><a href="#orgb12ce21">10.1. First Order Low Pass Filter</a></li>
2019-08-17 10:50:06 +02:00
</ul>
</li>
</ul>
</div>
</div>
2020-11-12 10:35:54 +01:00
<div id="outline-container-org90266e3" class="outline-2">
<h2 id="org90266e3"><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-11-12 10:35:54 +01:00
<div id="outline-container-org4291475" class="outline-3">
<h3 id="org4291475"><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-11-12 10:35:54 +01:00
<div id="org3a9bd55" 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-11-12 10:35:54 +01:00
<div id="outline-container-org88f266d" class="outline-3">
<h3 id="org88f266d"><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-11-12 10:35:54 +01:00
<div id="org666b377" 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-11-12 10:35:54 +01:00
<div id="outline-container-org1ee2123" class="outline-3">
<h3 id="org1ee2123"><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-11-12 10:35:54 +01:00
<div id="orgb9222b5" 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-11-12 10:35:54 +01:00
<div id="outline-container-orgd7f4531" class="outline-2">
<h2 id="orgd7f4531"><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-11-12 10:35:54 +01:00
<div id="outline-container-org5859621" class="outline-3">
<h3 id="org5859621"><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-11-12 10:35:54 +01:00
<div id="org422aab2" 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-11-12 10:35:54 +01:00
<div id="outline-container-org988fb36" class="outline-3">
<h3 id="org988fb36"><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-11-12 10:35:54 +01:00
<div id="org66dc7df" 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-11-12 10:35:54 +01:00
<div id="outline-container-orgd1ae949" class="outline-3">
<h3 id="orgd1ae949"><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-11-12 10:35:54 +01:00
<div id="orgc70858b" 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-11-12 10:35:54 +01:00
<div id="outline-container-org0871964" class="outline-2">
<h2 id="org0871964"><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-11-12 10:35:54 +01:00
<div id="outline-container-org020bd3f" class="outline-3">
<h3 id="org020bd3f"><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-11-12 10:35:54 +01:00
<div id="outline-container-org226333f" class="outline-2">
<h2 id="org226333f"><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-11-12 10:35:54 +01:00
<div id="outline-container-org5d6517b" class="outline-3">
<h3 id="org5d6517b"><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-11-12 10:35:54 +01:00
<div id="orgbb197d6" 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-11-12 10:35:54 +01:00
<div id="org5b3ff85" 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-11-12 10:35:54 +01:00
<div id="outline-container-orgff2aff5" class="outline-2">
<h2 id="orgff2aff5"><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-11-12 10:35:54 +01:00
<div id="outline-container-orgb7b715f" class="outline-3">
<h3 id="orgb7b715f"><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-11-12 10:35:54 +01:00
<div id="outline-container-orge46a59c" class="outline-2">
<h2 id="orge46a59c"><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-11-12 10:35:54 +01:00
<div id="outline-container-org6336fc3" class="outline-3">
<h3 id="org6336fc3"><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-11-12 10:35:54 +01:00
<li>the phase lead at \(\omega_c\) is equal to (Figure <a href="#orgefcd37b">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-11-12 10:35:54 +01:00
<div id="orga3b4f13" class="figure">
2020-10-26 14:04:35 +01:00
<p><img src="figs/filter_lead.png" alt="filter_lead.png" />
</p>
</div>
2020-11-12 10:35:54 +01:00
<div id="orgefcd37b" 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-11-12 10:35:54 +01:00
<div id="outline-container-org3797972" class="outline-3">
<h3 id="org3797972"><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-11-12 10:35:54 +01:00
<li>the phase lag at \(\omega_c\) is equal to (Figure <a href="#orgbed77d1">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-11-12 10:35:54 +01:00
<div id="orgce1450b" 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-11-12 10:35:54 +01:00
<div id="orgbed77d1" 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-11-12 10:35:54 +01:00
<div id="outline-container-org5e67a97" class="outline-2">
<h2 id="org5e67a97"><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-11-12 10:35:54 +01:00
<div id="outline-container-org74fba97" class="outline-2">
<h2 id="org74fba97"><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-11-12 10:35:54 +01:00
<div id="outline-container-org64d3111" class="outline-3">
<h3 id="org64d3111"><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-11-12 10:35:54 +01:00
<div id="outline-container-org978d37b" class="outline-3">
<h3 id="org978d37b"><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-11-12 10:35:54 +01:00
<div id="orgb351bf7" 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-11-12 10:35:54 +01:00
<div id="outline-container-org043cd0b" class="outline-2">
<h2 id="org043cd0b"><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-11-12 10:35:54 +01:00
<div id="outline-container-orgbb8d210" class="outline-3">
<h3 id="orgbb8d210"><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-11-12 10:35:54 +01:00
<div id="outline-container-orgc6eac8f" class="outline-3">
<h3 id="orgc6eac8f"><span class="section-number-3">9.2</span> Multiplicative</h3>
2020-10-26 14:04:35 +01:00
</div>
</div>
2020-11-12 10:35:54 +01:00
<div id="outline-container-org2616858" class="outline-2">
<h2 id="org2616858"><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-11-12 10:35:54 +01:00
<div id="outline-container-orgb12ce21" class="outline-3">
<h3 id="orgb12ce21"><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-11-12 10:35:54 +01:00
<p class="date">Created: 2020-11-12 jeu. 10:35</p>
2019-08-17 10:50:06 +02:00
</div>
</body>
</html>