dehaeze20_optim_robus_compl.../matlab/index_old.html

3687 lines
132 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?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-09-28 lun. 17:27 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Robust and Optimal Sensor Fusion - Matlab Computation</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Thomas Dehaeze" />
<link rel="stylesheet" type="text/css" href="../css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="../css/readtheorg.css"/>
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery.stickytableheaders.min.js"></script>
<script src="../js/readtheorg.js"></script>
<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>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="../index.html"> UP </a>
|
<a accesskey="H" href="../index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Robust and Optimal Sensor Fusion - Matlab Computation</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org1420806">1. Comparison with Bibliographic example</a>
<ul>
<li><a href="#orgbad1b0c">1.1. Bendat, J., Optimum filters for independent measurements of two related perturbed messages (1957)</a></li>
<li><a href="#org29f7897">1.2. Plummer, A. R., Optimal complementary filters and their application in motion measurement (2006)</a></li>
<li><a href="#orgcb5882c">1.3. Robert Grover Brown, P. Y. C. H., Introduction to random signals and applied kalman filtering with matlab exercises (2012)</a></li>
</ul>
</li>
<li><a href="#org6a5e24e">2. Optimal Sensor Fusion - Minimize the Super Sensor Noise</a>
<ul>
<li><a href="#org0c9f140">2.1. Architecture</a></li>
<li><a href="#orgd9c26a1">2.2. Noise of the sensors</a></li>
<li><a href="#orgd543cd2">2.3. H-Two Synthesis</a></li>
<li><a href="#org07d51ca">2.4. Alternative H-Two Synthesis</a></li>
<li><a href="#org9a856a2">2.5. H-Infinity Synthesis - method A</a></li>
<li><a href="#org8e9faf5">2.6. H-Infinity Synthesis - method B</a></li>
<li><a href="#org3cfba50">2.7. H-Infinity Synthesis - method C</a></li>
<li><a href="#orgfa66e55">2.8. Comparison of the methods</a></li>
<li><a href="#orgc0725f0">2.9. Obtained Super Sensor&rsquo;s noise uncertainty</a></li>
<li><a href="#orgd9e14cc">2.10. Conclusion</a></li>
</ul>
</li>
<li><a href="#org973040c">3. Optimal Sensor Fusion - Minimize the Super Sensor Dynamical Uncertainty</a>
<ul>
<li><a href="#org484d6ba">3.1. Super Sensor Dynamical Uncertainty</a></li>
<li><a href="#org427c0ac">3.2. Dynamical uncertainty of the individual sensors</a></li>
<li><a href="#orgb611d39">3.3. Synthesis objective</a></li>
<li><a href="#orgff5adc0">3.4. Requirements as an \(\mathcal{H}_\infty\) norm</a></li>
<li><a href="#orga726980">3.5. Weighting Function used to bound the super sensor uncertainty</a></li>
<li><a href="#orgb744213">3.6. \(\mathcal{H}_\infty\) Synthesis</a></li>
<li><a href="#org70db455">3.7. Super sensor uncertainty</a></li>
<li><a href="#org7adfdd3">3.8. Super sensor noise</a></li>
<li><a href="#orgcfc9f63">3.9. Conclusion</a></li>
</ul>
</li>
<li><a href="#org0a911c7">4. Optimal Sensor Fusion - Mixed Synthesis</a>
<ul>
<li><a href="#org1539be0">4.1. Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis - Introduction</a></li>
<li><a href="#org2d34714">4.2. Noise characteristics and Uncertainty of the individual sensors</a></li>
<li><a href="#org09ad6ba">4.3. Weighting Functions on the uncertainty of the super sensor</a></li>
<li><a href="#org0e50719">4.4. Mixed Synthesis Architecture</a></li>
<li><a href="#orgfd2638d">4.5. Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis</a></li>
<li><a href="#org42d85ce">4.6. Obtained Super Sensor&rsquo;s noise</a></li>
<li><a href="#org9e9b963">4.7. Obtained Super Sensor&rsquo;s Uncertainty</a></li>
<li><a href="#orgf6e9530">4.8. Conclusion</a></li>
</ul>
</li>
<li><a href="#orge39201f">5. Mixed Synthesis - LMI Optimization</a>
<ul>
<li><a href="#org95d320e">5.1. Introduction</a></li>
<li><a href="#org4b60f6e">5.2. Noise characteristics and Uncertainty of the individual sensors</a></li>
<li><a href="#org422d4ca">5.3. Weights</a></li>
<li><a href="#org1890686">5.4. LMI Optimization</a></li>
<li><a href="#orgbb11dc7">5.5. Result</a></li>
<li><a href="#org173a30e">5.6. Comparison with the matlab Mixed Synthesis</a></li>
<li><a href="#orgfa73512">5.7. H-Infinity Objective</a></li>
<li><a href="#org9ab9eef">5.8. Obtained Super Sensor&rsquo;s noise</a></li>
<li><a href="#orgacf7912">5.9. Obtained Super Sensor&rsquo;s Uncertainty</a></li>
</ul>
</li>
<li><a href="#org9d71301">6. H-Infinity synthesis to ensure both performance and robustness</a>
<ul>
<li><a href="#orgedd6d67">6.1. Introduction</a></li>
<li><a href="#orgf783f47">6.2. Dynamical uncertainty and Noise level of the individual sensors</a></li>
<li><a href="#org2197c97">6.3. Weights for uncertainty and performance</a></li>
<li><a href="#org24c30da">6.4. H-infinity synthesis with 4 outputs corresponding to the 4 weights</a></li>
<li><a href="#org0b9b366">6.5. Conclusion</a></li>
</ul>
</li>
<li><a href="#org234e3d5">7. Equivalent Super Sensor</a>
<ul>
<li><a href="#org830b01f">7.1. Sensor Fusion Architecture</a></li>
<li><a href="#org19369bb">7.2. Equivalent Configuration</a></li>
<li><a href="#org0bcdc83">7.3. Model the uncertainty of the super sensor</a></li>
<li><a href="#org9dcaa89">7.4. Model the noise of the super sensor</a></li>
<li><a href="#orge794bc8">7.5. First guess</a></li>
</ul>
</li>
<li><a href="#orgb29a257">8. Optimal And Robust Sensor Fusion in Practice</a>
<ul>
<li><a href="#orga412cf7">8.1. Measurement of the noise characteristics of the sensors</a>
<ul>
<li><a href="#orgce95926">8.1.1. Huddle Test</a></li>
<li><a href="#org60d7173">8.1.2. Weights that represents the noises&rsquo; PSD</a></li>
<li><a href="#org8a4e4ca">8.1.3. Comparison of the noises&rsquo; PSD</a></li>
<li><a href="#org185f2af">8.1.4. Computation of the coherence, power spectral density and cross spectral density of signals</a></li>
</ul>
</li>
<li><a href="#org5894e0f">8.2. Estimate the dynamic uncertainty of the sensors</a></li>
<li><a href="#org770784c">8.3. Optimal and Robust synthesis of the complementary filters</a></li>
</ul>
</li>
<li><a href="#org1da98cf">9. Methods of complementary filter synthesis</a>
<ul>
<li><a href="#org84dfcf2">9.1. Complementary filters using analytical formula</a>
<ul>
<li><a href="#org5e7f279">9.1.1. Analytical 1st order complementary filters</a></li>
<li><a href="#org779fef3">9.1.2. Second Order Complementary Filters</a></li>
<li><a href="#org4d7734e">9.1.3. Third Order Complementary Filters</a></li>
</ul>
</li>
<li><a href="#orgdf0d46f">9.2. H-Infinity synthesis of complementary filters</a>
<ul>
<li><a href="#org1c357b3">9.2.1. Synthesis Architecture</a></li>
<li><a href="#orgaff5449">9.2.2. Weights</a></li>
<li><a href="#org6938d30">9.2.3. H-Infinity Synthesis</a></li>
<li><a href="#org890772f">9.2.4. Obtained Complementary Filters</a></li>
</ul>
</li>
<li><a href="#orgeac5c0a">9.3. Feedback Control Architecture to generate Complementary Filters</a>
<ul>
<li><a href="#orgfb21c1d">9.3.1. Architecture</a></li>
<li><a href="#orgd0b6480">9.3.2. Loop Gain Design</a></li>
<li><a href="#orga4c7aef">9.3.3. Complementary Filters Obtained</a></li>
</ul>
</li>
<li><a href="#org1fdacfa">9.4. Analytical Formula found in the literature</a>
<ul>
<li><a href="#org9dc41c5">9.4.1. Analytical Formula</a></li>
<li><a href="#org08a60d2">9.4.2. Matlab</a></li>
<li><a href="#org987779d">9.4.3. Discussion</a></li>
</ul>
</li>
<li><a href="#orge65c21c">9.5. Comparison of the different methods of synthesis</a></li>
</ul>
</li>
<li><a href="#org8912234">10. Real World Example of optimal sensor fusion</a>
<ul>
<li><a href="#orge687802">10.1. Matlab Code</a></li>
<li><a href="#org617a4c7">10.2. Time domain signals</a></li>
<li><a href="#org127a184">10.3. H2 Synthesis</a></li>
<li><a href="#org164d058">10.4. Signal and Noise</a></li>
<li><a href="#orgec23fa5">10.5. PSD and CPS</a></li>
<li><a href="#org934b67a">10.6. Transfer function of the super sensor</a></li>
</ul>
</li>
</ul>
</div>
</div>
<p>
In this document, the optimal and robust design of complementary filters is studied.
</p>
<p>
Two sensors are considered with both different noise characteristics and dynamical uncertainties represented by multiplicative input uncertainty.
</p>
<ul class="org-ul">
<li>in section <a href="#org7f492e4">2</a>: the \(\mathcal{H}_2\) synthesis is used to design complementary filters such that the RMS value of the super sensor&rsquo;s noise is minimized</li>
<li>in section <a href="#org5315886">3</a>: the \(\mathcal{H}_\infty\) synthesis is used to design complementary filters such that the super sensor&rsquo;s uncertainty is bonded to acceptable values</li>
<li>in section <a href="#org05cb81a">4</a>: the mixed \(\mathcal{H}_2/\mathcal{H}_\infty\) synthesis is used to both limit the super sensor&rsquo;s uncertainty and to lower the RMS value of the super sensor&rsquo;s noise</li>
<li>in section <a href="#org5426240">6</a>: the \(\mathcal{H}_\infty\) synthesis is used for both limiting the noise and uncertainty of the super sensor</li>
<li>in section <a href="#orgde63ba6">7</a>: we try to find the characteristics of the super sensor from the characteristics of the individual sensors and of the complementary filters</li>
<li>in section <a href="#orgd4ca2cf">8</a>: a methodology is proposed to apply optimal and robust sensor fusion in practice</li>
<li>in section <a href="#org64a9222">9</a>: methods of complementary filter synthesis are proposed</li>
</ul>
<div id="outline-container-org1420806" class="outline-2">
<h2 id="org1420806"><span class="section-number-2">1</span> Comparison with Bibliographic example</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-orgbad1b0c" class="outline-3">
<h3 id="orgbad1b0c"><span class="section-number-3">1.1</span> Bendat, J., Optimum filters for independent measurements of two related perturbed messages (1957)</h3>
<div class="outline-text-3" id="text-1-1">
<p>
(<a href="#citeproc_bib_item_3">Bendat 1957</a>)
</p>
<div class="org-src-container">
<pre class="src src-matlab">freqs = logspace(-1, 2, 1000);
</pre>
</div>
<p>
Weights to shape the noise of both sensors:
</p>
<div class="org-src-container">
<pre class="src src-matlab">K1 = 100;
K2 = 1;
b = 10;
b1 = b;
b2 = b;
N1 = sqrt(K1)*b1/(b1+s)/(s + 1e-2);
N2 = sqrt(K2)*b2/(b2+s);
</pre>
</div>
<div id="org86e456d" class="figure">
<p><img src="figs/bendat57_noise_weights.png" alt="bendat57_noise_weights.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Weights</p>
</div>
<p>
\(\mathcal{H}_2\) synthesis:
</p>
<div class="org-src-container">
<pre class="src src-matlab">P = [0 N2 1;
N1 -N2 0];
[H1, ~, gamma] = h2syn(P, 1, 1);
H2 = 1 - H1;
</pre>
</div>
<p>
The optimal obtained filter (from the paper) is:
</p>
<div class="org-src-container">
<pre class="src src-matlab">a = sqrt(K2/K1);
G = (a*s + 1 + a*b)/(1 + a*b)/(a*s + 1);
</pre>
</div>
<div id="org14955cd" class="figure">
<p><img src="figs/bendat57_optimal_filters.png" alt="bendat57_optimal_filters.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Obtain Filters</p>
</div>
<div id="org40141bd" class="figure">
<p><img src="figs/bendat57_psd_estimation.png" alt="bendat57_psd_estimation.png" />
</p>
<p><span class="figure-number">Figure 3: </span>PSD of the individual sensors + super sensor</p>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">RMS</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Sensor 1</td>
<td class="org-right">22.93</td>
</tr>
<tr>
<td class="org-left">Sensor 2</td>
<td class="org-right">2.37</td>
</tr>
<tr>
<td class="org-left">H2 Synthesis</td>
<td class="org-right">1.74</td>
</tr>
<tr>
<td class="org-left">Paper</td>
<td class="org-right">1.74</td>
</tr>
</tbody>
</table>
</div>
</div>
<div id="outline-container-org29f7897" class="outline-3">
<h3 id="org29f7897"><span class="section-number-3">1.2</span> Plummer, A. R., Optimal complementary filters and their application in motion measurement (2006)</h3>
<div class="outline-text-3" id="text-1-2">
<p>
(<a href="#citeproc_bib_item_8">Plummer 2006</a>)
</p>
<p>
Weights
</p>
<div class="org-src-container">
<pre class="src src-matlab">N1 = 24.3e-6*(s + 2*pi*0.1)*(s + 1220)/1220*(1/(1 + s/2/pi/1e4)/(1 + s/2/pi/1e4));
N2 = 0.363/(s + 0.01)*(s + 12.2)/(s + 0.01);
</pre>
</div>
<div id="org7cba6d9" class="figure">
<p><img src="figs/plummer06_noise_weights.png" alt="plummer06_noise_weights.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Weights</p>
</div>
<p>
\(\mathcal{H}_2\) synthesis:
</p>
<div class="org-src-container">
<pre class="src src-matlab">P = [0 N2 1;
N1 -N2 0];
[H1, ~, gamma] = h2syn(P, 1, 1);
H2 = 1 - H1;
</pre>
</div>
<p>
The optimal obtained filter (from the paper) is:
</p>
<div class="org-src-container">
<pre class="src src-matlab">G = (0.0908*s + 1)/(5.51e-7*s^3 + 7.47e-4*s^2 + 0.0908*s + 1);
</pre>
</div>
<div id="org5a35349" class="figure">
<p><img src="figs/plummer06_optimal_filters.png" alt="plummer06_optimal_filters.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Obtain Filters</p>
</div>
<div id="org4125a6f" class="figure">
<p><img src="figs/plummer06_psd_estimation.png" alt="plummer06_psd_estimation.png" />
</p>
<p><span class="figure-number">Figure 6: </span>PSD of the individual sensors + super sensor</p>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">RMS</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Sensor 1</td>
<td class="org-right">130.0</td>
</tr>
<tr>
<td class="org-left">Sensor 2</td>
<td class="org-right">0.00753</td>
</tr>
<tr>
<td class="org-left">H2 Synthesis</td>
<td class="org-right">0.00091</td>
</tr>
<tr>
<td class="org-left">Paper</td>
<td class="org-right">0.0107</td>
</tr>
</tbody>
</table>
<p>
Parameters of the time domain simulation.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Fs = 2.5e3; % Sampling Frequency [Hz]
Ts = 1/Fs; % Sampling Time [s]
t = 0:Ts:2; % Time Vector [s]
</pre>
</div>
<p>
Generate noises in velocity corresponding to sensor 1 and 2:
</p>
<div class="org-src-container">
<pre class="src src-matlab">n1 = lsim(N1, sqrt(Fs/2)*randn(length(t), 1), t);
n2 = lsim(N2, sqrt(Fs/2)*randn(length(t), 1), t);
</pre>
</div>
<div id="orgf975db7" class="figure">
<p><img src="figs/plummer06_time_domain_signals.png" alt="plummer06_time_domain_signals.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Time domain signals</p>
</div>
</div>
</div>
<div id="outline-container-orgcb5882c" class="outline-3">
<h3 id="orgcb5882c"><span class="section-number-3">1.3</span> Robert Grover Brown, P. Y. C. H., Introduction to random signals and applied kalman filtering with matlab exercises (2012)</h3>
<div class="outline-text-3" id="text-1-3">
<p>
(<a href="#citeproc_bib_item_9">Robert Grover Brown 2012</a>) Section 8.6
</p>
<div class="org-src-container">
<pre class="src src-matlab">w0 = 1; % [rad/s]
wc = 20*w0; % [rad/s]
k1 = sqrt(200*sqrt(2)*w0^3); % [m]
k2 = sqrt(100*pi/wc); % [m]
N1 = k1/(s^2 + sqrt(2)*s + 1);
N2 = k2/(1 + s/(wc*(2/pi)));
</pre>
</div>
<div id="orgf24a2fe" class="figure">
<p><img src="figs/robert12_noise_weights.png" alt="robert12_noise_weights.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Weights</p>
</div>
<p>
And we do the \(\mathcal{H}_2\) synthesis using the <code>h2syn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">P = [0 N2 1;
N1 -N2 0];
[H1, ~, gamma] = h2syn(P, 1, 1);
H2 = 1 - H1;
</pre>
</div>
<div id="orgad0d9fd" class="figure">
<p><img src="figs/robert12_optimal_filters.png" alt="robert12_optimal_filters.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Obtain Filters</p>
</div>
<div id="org4b7fd01" class="figure">
<p><img src="figs/robert12_psd_estimation.png" alt="robert12_psd_estimation.png" />
</p>
<p><span class="figure-number">Figure 10: </span>PSD of the individual sensors + super sensor</p>
</div>
<p>
We can see that the optimal \(\mathcal{H}_2\) control gives similar results as Kalman filtering.
</p>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Method</th>
<th scope="col" class="org-right">Mean Square Error</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Kalman Filter</td>
<td class="org-right">21.47</td>
</tr>
<tr>
<td class="org-left">Euristic</td>
<td class="org-right">35.32</td>
</tr>
<tr>
<td class="org-left">Optimal H2</td>
<td class="org-right">20.96</td>
</tr>
</tbody>
</table>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">Method</th>
<th scope="col" class="org-right">Mean Square Error</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Kalman Filter</td>
<td class="org-right">21.47</td>
</tr>
<tr>
<td class="org-left">Euristic</td>
<td class="org-right">35.32</td>
</tr>
</tbody>
<tbody>
<tr>
<td class="org-left">Optimal H2</td>
<td class="org-right">21.40</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
<div id="outline-container-org6a5e24e" class="outline-2">
<h2 id="org6a5e24e"><span class="section-number-2">2</span> Optimal Sensor Fusion - Minimize the Super Sensor Noise</h2>
<div class="outline-text-2" id="text-2">
<p>
<a id="org7f492e4"></a>
</p>
<p>
The idea is to combine sensors that works in different frequency range using complementary filters.
</p>
<p>
Doing so, one &ldquo;super sensor&rdquo; is obtained that can have better noise characteristics than the individual sensors over a large frequency range.
</p>
<p>
The complementary filters have to be designed in order to minimize the effect noise of each sensor on the super sensor noise.
</p>
<div class="note">
<p>
The Matlab scripts is accessible <a href="matlab/optimal_comp_filters.m">here</a>.
</p>
</div>
</div>
<div id="outline-container-org0c9f140" class="outline-3">
<h3 id="org0c9f140"><span class="section-number-3">2.1</span> Architecture</h3>
<div class="outline-text-3" id="text-2-1">
<p>
Let&rsquo;s consider the sensor fusion architecture shown on figure <a href="#org6b7985b">11</a> where two sensors (sensor 1 and sensor 2) are measuring the same quantity \(x\) with different noise characteristics determined by \(N_1(s)\) and \(N_2(s)\).
</p>
<p>
\(\tilde{n}_1\) and \(\tilde{n}_2\) are normalized white noise:
</p>
\begin{equation}
\label{org800b631}
\Phi_{\tilde{n}_1}(\omega) = \Phi_{\tilde{n}_2}(\omega) = 1
\end{equation}
<div id="org6b7985b" class="figure">
<p><img src="figs-tikz/fusion_two_noisy_sensors_weights.png" alt="fusion_two_noisy_sensors_weights.png" />
</p>
<p><span class="figure-number">Figure 11: </span>Fusion of two sensors</p>
</div>
<p>
We consider that the two sensor dynamics \(G_1(s)\) and \(G_2(s)\) are ideal:
</p>
\begin{equation}
\label{orgc324337}
G_1(s) = G_2(s) = 1
\end{equation}
<p>
We obtain the architecture of figure <a href="#org24d2f93">12</a>.
</p>
<div id="org24d2f93" class="figure">
<p><img src="figs-tikz/sensor_fusion_noisy_perfect_dyn.png" alt="sensor_fusion_noisy_perfect_dyn.png" />
</p>
<p><span class="figure-number">Figure 12: </span>Fusion of two sensors with ideal dynamics</p>
</div>
<p>
\(H_1(s)\) and \(H_2(s)\) are complementary filters:
</p>
\begin{equation}
\label{org8e22dff}
H_1(s) + H_2(s) = 1
\end{equation}
<p>
The goal is to design \(H_1(s)\) and \(H_2(s)\) such that the effect of the noise sources \(\tilde{n}_1\) and \(\tilde{n}_2\) has the smallest possible effect on the estimation \(\hat{x}\).
</p>
<p>
We have that the Power Spectral Density (PSD) of \(\hat{x}\) is:
\[ \Phi_{\hat{x}}(\omega) = |H_1(j\omega) N_1(j\omega)|^2 \Phi_{\tilde{n}_1}(\omega) + |H_2(j\omega) N_2(j\omega)|^2 \Phi_{\tilde{n}_2}(\omega), \quad \forall \omega \]
</p>
<p>
And the goal is the minimize the Root Mean Square (RMS) value of \(\hat{x}\):
</p>
\begin{equation}
\label{orgeef7d07}
\sigma_{\hat{x}} = \sqrt{\int_0^\infty \Phi_{\hat{x}}(\omega) d\omega}
\end{equation}
</div>
</div>
<div id="outline-container-orgd9c26a1" class="outline-3">
<h3 id="orgd9c26a1"><span class="section-number-3">2.2</span> Noise of the sensors</h3>
<div class="outline-text-3" id="text-2-2">
<p>
Let&rsquo;s define the noise characteristics of the two sensors by choosing \(N_1\) and \(N_2\):
</p>
<ul class="org-ul">
<li>Sensor 1 characterized by \(N_1(s)\) has low noise at low frequency (for instance a geophone)</li>
<li>Sensor 2 characterized by \(N_2(s)\) has low noise at high frequency (for instance an accelerometer)</li>
</ul>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4;
N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100);
omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8;
N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
</pre>
</div>
<div id="org42e11bd" class="figure">
<p><img src="figs/noise_characteristics_sensors.png" alt="noise_characteristics_sensors.png" />
</p>
<p><span class="figure-number">Figure 13: </span>Noise Characteristics of the two sensors (<a href="./figs/noise_characteristics_sensors.png">png</a>, <a href="./figs/noise_characteristics_sensors.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgd543cd2" class="outline-3">
<h3 id="orgd543cd2"><span class="section-number-3">2.3</span> H-Two Synthesis</h3>
<div class="outline-text-3" id="text-2-3">
<p>
As \(\tilde{n}_1\) and \(\tilde{n}_2\) are normalized white noise: \(\Phi_{\tilde{n}_1}(\omega) = \Phi_{\tilde{n}_2}(\omega) = 1\) and we have:
\[ \sigma_{\hat{x}} = \sqrt{\int_0^\infty |H_1 N_1|^2(\omega) + |H_2 N_2|^2(\omega) d\omega} = \left\| \begin{matrix} H_1 N_1 \\ H_2 N_2 \end{matrix} \right\|_2 \]
Thus, the goal is to design \(H_1(s)\) and \(H_2(s)\) such that \(H_1(s) + H_2(s) = 1\) and such that \(\left\| \begin{matrix} H_1 N_1 \\ H_2 N_2 \end{matrix} \right\|_2\) is minimized.
</p>
<p>
For that, we use the \(\mathcal{H}_2\) Synthesis.
</p>
<p>
We use the generalized plant architecture shown on figure <a href="#org0037ebd">14</a>.
</p>
<div id="org0037ebd" class="figure">
<p><img src="figs-tikz/h_infinity_optimal_comp_filters.png" alt="h_infinity_optimal_comp_filters.png" />
</p>
<p><span class="figure-number">Figure 14: </span>\(\mathcal{H}_2\) Synthesis - Generalized plant used for the optimal generation of complementary filters</p>
</div>
\begin{equation*}
\begin{pmatrix}
z \\ v
\end{pmatrix} = \begin{pmatrix}
0 & N_2 & 1 \\
N_1 & -N_2 & 0
\end{pmatrix} \begin{pmatrix}
w_1 \\ w_2 \\ u
\end{pmatrix}
\end{equation*}
<p>
The transfer function from \([n_1, n_2]\) to \(\hat{x}\) is:
\[ \begin{bmatrix} N_1 H_1 \\ N_2 (1 - H_1) \end{bmatrix} \]
If we define \(H_2 = 1 - H_1\), we obtain:
\[ \begin{bmatrix} N_1 H_1 \\ N_2 H_2 \end{bmatrix} \]
</p>
<p>
Thus, if we minimize the \(\mathcal{H}_2\) norm of this transfer function, we minimize the RMS value of \(\hat{x}\).
</p>
<p>
We define the generalized plant \(P\) on matlab as shown on figure <a href="#org0037ebd">14</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">P = [0 N2 1;
N1 -N2 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_2\) synthesis using the <code>h2syn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H1, ~, gamma] = h2syn(P, 1, 1);
</pre>
</div>
<p>
Finally, we define \(H_2(s) = 1 - H_1(s)\).
</p>
<div class="org-src-container">
<pre class="src src-matlab">H2 = 1 - H1;
</pre>
</div>
<p>
The complementary filters obtained are shown on figure <a href="#org2f5140b">15</a>.
</p>
<p>
The PSD of the noise of the individual sensor and of the super sensor are shown in Fig. <a href="#orgdaf4347">16</a>.
</p>
<p>
The Cumulative Power Spectrum (CPS) is shown on Fig. <a href="#org584635d">17</a>.
</p>
<p>
The obtained RMS value of the super sensor is lower than the RMS value of the individual sensors.
</p>
<div id="org2f5140b" class="figure">
<p><img src="figs/htwo_comp_filters.png" alt="htwo_comp_filters.png" />
</p>
<p><span class="figure-number">Figure 15: </span>Obtained complementary filters using the \(\mathcal{H}_2\) Synthesis (<a href="./figs/htwo_comp_filters.png">png</a>, <a href="./figs/htwo_comp_filters.pdf">pdf</a>)</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">PSD_S1 = abs(squeeze(freqresp(N1, freqs, 'Hz'))).^2;
PSD_S2 = abs(squeeze(freqresp(N2, freqs, 'Hz'))).^2;
PSD_H2 = abs(squeeze(freqresp(N1*H1, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2, freqs, 'Hz'))).^2;
</pre>
</div>
<div id="orgdaf4347" class="figure">
<p><img src="figs/psd_sensors_htwo_synthesis.png" alt="psd_sensors_htwo_synthesis.png" />
</p>
<p><span class="figure-number">Figure 16: </span>Power Spectral Density of the estimated \(\hat{x}\) using the two sensors alone and using the optimally fused signal (<a href="./figs/psd_sensors_htwo_synthesis.png">png</a>, <a href="./figs/psd_sensors_htwo_synthesis.pdf">pdf</a>)</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">CPS_S1 = 1/pi*cumtrapz(2*pi*freqs, PSD_S1);
CPS_S2 = 1/pi*cumtrapz(2*pi*freqs, PSD_S2);
CPS_H2 = 1/pi*cumtrapz(2*pi*freqs, PSD_H2);
</pre>
</div>
<div id="org584635d" class="figure">
<p><img src="figs/cps_h2_synthesis.png" alt="cps_h2_synthesis.png" />
</p>
<p><span class="figure-number">Figure 17: </span>Cumulative Power Spectrum of individual sensors and super sensor using the \(\mathcal{H}_2\) synthesis (<a href="./figs/cps_h2_synthesis.png">png</a>, <a href="./figs/cps_h2_synthesis.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org07d51ca" class="outline-3">
<h3 id="org07d51ca"><span class="section-number-3">2.4</span> Alternative H-Two Synthesis</h3>
<div class="outline-text-3" id="text-2-4">
<p>
An alternative Alternative formulation of the \(\mathcal{H}_2\) synthesis is shown in Fig. <a href="#orga26826d">18</a>.
</p>
<div id="orga26826d" class="figure">
<p><img src="figs-tikz/h_infinity_optimal_comp_filters_bis.png" alt="h_infinity_optimal_comp_filters_bis.png" />
</p>
<p><span class="figure-number">Figure 18: </span>Alternative formulation of the \(\mathcal{H}_2\) synthesis</p>
</div>
\begin{equation*}
\begin{pmatrix}
z_1 \\ z_2 \\ v
\end{pmatrix} = \begin{pmatrix}
N_1 & -N_1 \\
0 & N_2 \\
1 & 0
\end{pmatrix} \begin{pmatrix}
w \\ u
\end{pmatrix}
\end{equation*}
</div>
</div>
<div id="outline-container-org9a856a2" class="outline-3">
<h3 id="org9a856a2"><span class="section-number-3">2.5</span> H-Infinity Synthesis - method A</h3>
<div class="outline-text-3" id="text-2-5">
<p>
Another objective that we may have is that the noise of the super sensor \(n_{SS}\) is following the minimum of the noise of the two sensors \(n_1\) and \(n_2\):
\[ \Gamma_{n_{ss}}(\omega) = \min(\Gamma_{n_1}(\omega),\ \Gamma_{n_2}(\omega)) \]
</p>
<p>
In order to obtain that ideal case, we need that the complementary filters be designed such that:
</p>
\begin{align*}
& |H_1(j\omega)| = 1 \text{ and } |H_2(j\omega)| = 0 \text{ at frequencies where } \Gamma_{n_1}(\omega) < \Gamma_{n_2}(\omega) \\
& |H_1(j\omega)| = 0 \text{ and } |H_2(j\omega)| = 1 \text{ at frequencies where } \Gamma_{n_1}(\omega) > \Gamma_{n_2}(\omega)
\end{align*}
<p>
Which is indeed impossible in practice.
</p>
<p>
We could try to approach that with the \(\mathcal{H}_\infty\) synthesis by using high order filters.
</p>
<p>
As shown on Fig. <a href="#org42e11bd">13</a>, the frequency where the two sensors have the same noise level is around 9Hz.
We will thus choose weighting functions such that the merging frequency is around 9Hz.
</p>
<p>
The weighting functions used as well as the obtained complementary filters are shown in Fig. <a href="#org78f9fa7">19</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">n = 5; w0 = 2*pi*10; G0 = 1/10; G1 = 10000; Gc = 1/2;
W1a = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
n = 5; w0 = 2*pi*8; G0 = 1000; G1 = 0.1; Gc = 1/2;
W2a = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">P = [W1a -W1a;
0 W2a;
1 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_\infty\) synthesis using the <code>hinfsyn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H2a, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
</pre>
</div>
<pre class="example">
[H2a, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
Resetting value of Gamma min based on D_11, D_12, D_21 terms
Test bounds: 0.1000 &lt; gamma &lt;= 10500.0000
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
1.050e+04 2.1e+01 -3.0e-07 7.8e+00 -1.3e-15 0.0000 p
5.250e+03 2.1e+01 -1.5e-08 7.8e+00 -5.8e-14 0.0000 p
2.625e+03 2.1e+01 2.5e-10 7.8e+00 -3.7e-12 0.0000 p
1.313e+03 2.1e+01 -3.2e-11 7.8e+00 -7.3e-14 0.0000 p
656.344 2.1e+01 -2.2e-10 7.8e+00 -1.1e-15 0.0000 p
328.222 2.1e+01 -1.1e-10 7.8e+00 -1.2e-15 0.0000 p
164.161 2.1e+01 -2.4e-08 7.8e+00 -8.9e-16 0.0000 p
82.130 2.1e+01 2.0e-10 7.8e+00 -9.1e-31 0.0000 p
41.115 2.1e+01 -6.8e-09 7.8e+00 -4.1e-13 0.0000 p
20.608 2.1e+01 3.3e-10 7.8e+00 -1.4e-12 0.0000 p
10.354 2.1e+01 -9.8e-09 7.8e+00 -1.8e-15 0.0000 p
5.227 2.1e+01 -4.1e-09 7.8e+00 -2.5e-12 0.0000 p
2.663 2.1e+01 2.7e-10 7.8e+00 -4.0e-14 0.0000 p
1.382 2.1e+01 -3.2e+05# 7.8e+00 -3.5e-14 0.0000 f
2.023 2.1e+01 -5.0e-10 7.8e+00 0.0e+00 0.0000 p
1.702 2.1e+01 -2.4e+07# 7.8e+00 -1.6e-13 0.0000 f
1.862 2.1e+01 -6.0e+08# 7.8e+00 -1.0e-12 0.0000 f
1.942 2.1e+01 -2.8e-09 7.8e+00 -8.1e-14 0.0000 p
1.902 2.1e+01 -2.5e-09 7.8e+00 -1.1e-13 0.0000 p
1.882 2.1e+01 -9.3e-09 7.8e+00 -2.0e-15 0.0001 p
1.872 2.1e+01 -1.3e+09# 7.8e+00 -3.6e-22 0.0000 f
1.877 2.1e+01 -2.6e+09# 7.8e+00 -1.2e-13 0.0000 f
1.880 2.1e+01 -5.6e+09# 7.8e+00 -1.4e-13 0.0000 f
1.881 2.1e+01 -1.2e+10# 7.8e+00 -3.3e-12 0.0000 f
1.882 2.1e+01 -3.2e+10# 7.8e+00 -8.5e-14 0.0001 f
Gamma value achieved: 1.8824
</pre>
<div class="org-src-container">
<pre class="src src-matlab">H1a = 1 - H2a;
</pre>
</div>
<div id="org78f9fa7" class="figure">
<p><img src="figs/weights_comp_filters_Hinfa.png" alt="weights_comp_filters_Hinfa.png" />
</p>
<p><span class="figure-number">Figure 19: </span>Weights and Complementary Fitlers obtained (<a href="./figs/weights_comp_filters_Hinfa.png">png</a>, <a href="./figs/weights_comp_filters_Hinfa.pdf">pdf</a>)</p>
</div>
<p>
We then compute the Power Spectral Density as well as the Cumulative Power Spectrum.
</p>
<div class="org-src-container">
<pre class="src src-matlab">PSD_Ha = abs(squeeze(freqresp(N1*H1a, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2a, freqs, 'Hz'))).^2;
CPS_Ha = 1/pi*cumtrapz(2*pi*freqs, PSD_Ha);
</pre>
</div>
</div>
</div>
<div id="outline-container-org8e9faf5" class="outline-3">
<h3 id="org8e9faf5"><span class="section-number-3">2.6</span> H-Infinity Synthesis - method B</h3>
<div class="outline-text-3" id="text-2-6">
<p>
We have that:
\[ \Phi_{\hat{x}}(\omega) = \left|H_1(j\omega) N_1(j\omega)\right|^2 + \left|H_2(j\omega) N_2(j\omega)\right|^2 \]
</p>
<p>
Then, at frequencies where \(|H_1(j\omega)| < |H_2(j\omega)|\) we would like that \(|N_1(j\omega)| = 1\) and \(|N_2(j\omega)| = 0\) as we discussed before.
Then \(|H_1 N_1|^2 + |H_2 N_2|^2 = |N_1|^2\).
</p>
<p>
We know that this is impossible in practice. A more realistic choice is to design \(H_2(s)\) such that when \(|N_2(j\omega)| > |N_1(j\omega)|\), we have that:
\[ |H_2 N_2|^2 = \epsilon |H_1 N_1|^2 \]
</p>
<p>
Which is equivalent to have (by supposing \(|H_1| \approx 1\)):
\[ |H_2| = \sqrt{\epsilon} \frac{|N_1|}{|N_2|} \]
</p>
<p>
And we have:
</p>
\begin{align*}
\Phi_{\hat{x}} &= \left|H_1 N_1\right|^2 + |H_2 N_2|^2 \\
&= (1 + \epsilon) \left| H_1 N_1 \right|^2 \\
&\approx \left|N_1\right|^2
\end{align*}
<p>
Similarly, we design \(H_1(s)\) such that at frequencies where \(|N_1| > |N_2|\):
\[ |H_1| = \sqrt{\epsilon} \frac{|N_2|}{|N_1|} \]
</p>
<p>
For instance, is we take \(\epsilon = 1\), then the PSD of \(\hat{x}\) is increased by just by a factor \(\sqrt{2}\) over the all frequencies from the idea case.
</p>
<p>
We use this as the weighting functions for the \(\mathcal{H}_\infty\) synthesis of the complementary filters.
</p>
<p>
The weighting function and the obtained complementary filters are shown in Fig. <a href="#org15d6f24">20</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">epsilon = 2;
W1b = 1/epsilon*N1/N2;
W2b = 1/epsilon*N2/N1;
W1b = W1b/(1 + s/2/pi/1000); % this is added so that it is proper
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">P = [W1b -W1b;
0 W2b;
1 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_\infty\) synthesis using the <code>hinfsyn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H2b, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
</pre>
</div>
<pre class="example">
[H2b, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
Test bounds: 0.0000 &lt; gamma &lt;= 32.8125
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
32.812 1.8e+01 3.4e-10 6.3e+00 -2.9e-13 0.0000 p
16.406 1.8e+01 3.4e-10 6.3e+00 -1.2e-15 0.0000 p
8.203 1.8e+01 3.3e-10 6.3e+00 -2.6e-13 0.0000 p
4.102 1.8e+01 3.3e-10 6.3e+00 -2.1e-13 0.0000 p
2.051 1.7e+01 3.4e-10 6.3e+00 -7.2e-16 0.0000 p
1.025 1.6e+01 -1.3e+06# 6.3e+00 -8.3e-14 0.0000 f
1.538 1.7e+01 3.4e-10 6.3e+00 -2.0e-13 0.0000 p
1.282 1.7e+01 3.4e-10 6.3e+00 -7.9e-17 0.0000 p
1.154 1.7e+01 3.6e-10 6.3e+00 -1.8e-13 0.0000 p
1.089 1.7e+01 -3.4e+06# 6.3e+00 -1.7e-13 0.0000 f
1.122 1.7e+01 -1.0e+07# 6.3e+00 -3.2e-13 0.0000 f
1.138 1.7e+01 -1.3e+08# 6.3e+00 -1.8e-13 0.0000 f
1.146 1.7e+01 3.2e-10 6.3e+00 -3.0e-13 0.0000 p
1.142 1.7e+01 5.5e-10 6.3e+00 -2.8e-13 0.0000 p
1.140 1.7e+01 -1.5e-10 6.3e+00 -2.3e-13 0.0000 p
1.139 1.7e+01 -4.8e+08# 6.3e+00 -6.2e-14 0.0000 f
1.139 1.7e+01 1.3e-09 6.3e+00 -8.9e-17 0.0000 p
Gamma value achieved: 1.1390
</pre>
<div class="org-src-container">
<pre class="src src-matlab">H1b = 1 - H2b;
</pre>
</div>
<div id="org15d6f24" class="figure">
<p><img src="figs/weights_comp_filters_Hinfb.png" alt="weights_comp_filters_Hinfb.png" />
</p>
<p><span class="figure-number">Figure 20: </span>Weights and Complementary Fitlers obtained (<a href="./figs/weights_comp_filters_Hinfb.png">png</a>, <a href="./figs/weights_comp_filters_Hinfb.pdf">pdf</a>)</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">PSD_Hb = abs(squeeze(freqresp(N1*H1b, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2b, freqs, 'Hz'))).^2;
CPS_Hb = 1/pi*cumtrapz(2*pi*freqs, PSD_Hb);
</pre>
</div>
</div>
</div>
<div id="outline-container-org3cfba50" class="outline-3">
<h3 id="org3cfba50"><span class="section-number-3">2.7</span> H-Infinity Synthesis - method C</h3>
<div class="outline-text-3" id="text-2-7">
<div class="org-src-container">
<pre class="src src-matlab">Wp = 0.56*(inv(N1)+inv(N2))/(1 + s/2/pi/1000);
W1c = N1*Wp;
W2c = N2*Wp;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">P = [W1c -W1c;
0 W2c;
1 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_\infty\) synthesis using the <code>hinfsyn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H2c, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
</pre>
</div>
<pre class="example">
[H2c, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
Test bounds: 0.0000 &lt; gamma &lt;= 36.7543
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
36.754 5.7e+00 -1.0e-13 6.3e+00 -6.2e-25 0.0000 p
18.377 5.7e+00 -1.4e-12 6.3e+00 -1.8e-13 0.0000 p
9.189 5.7e+00 -4.3e-13 6.3e+00 -4.7e-15 0.0000 p
4.594 5.7e+00 -9.4e-13 6.3e+00 -4.7e-15 0.0000 p
2.297 5.7e+00 -1.3e-16 6.3e+00 -6.8e-14 0.0000 p
1.149 5.7e+00 -1.6e-17 6.3e+00 -1.5e-15 0.0000 p
0.574 5.7e+00 -5.2e+02# 6.3e+00 -5.9e-14 0.0000 f
0.861 5.7e+00 -3.1e+04# 6.3e+00 -3.8e-14 0.0000 f
1.005 5.7e+00 -1.6e-12 6.3e+00 -1.1e-14 0.0000 p
0.933 5.7e+00 -1.1e+05# 6.3e+00 -7.2e-14 0.0000 f
0.969 5.7e+00 -3.3e+05# 6.3e+00 -5.6e-14 0.0000 f
0.987 5.7e+00 -1.2e+06# 6.3e+00 -4.5e-15 0.0000 f
0.996 5.7e+00 -6.5e-16 6.3e+00 -1.7e-15 0.0000 p
0.992 5.7e+00 -2.9e+06# 6.3e+00 -6.1e-14 0.0000 f
0.994 5.7e+00 -9.7e+06# 6.3e+00 -3.0e-16 0.0000 f
0.995 5.7e+00 -8.0e-10 6.3e+00 -1.9e-13 0.0000 p
0.994 5.7e+00 -2.3e+07# 6.3e+00 -4.3e-14 0.0000 f
Gamma value achieved: 0.9949
</pre>
<div class="org-src-container">
<pre class="src src-matlab">H1c = 1 - H2c;
</pre>
</div>
<div id="org6a8d589" class="figure">
<p><img src="figs/weights_comp_filters_Hinfc.png" alt="weights_comp_filters_Hinfc.png" />
</p>
<p><span class="figure-number">Figure 21: </span>Weights and Complementary Fitlers obtained (<a href="./figs/weights_comp_filters_Hinfc.png">png</a>, <a href="./figs/weights_comp_filters_Hinfc.pdf">pdf</a>)</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab">PSD_Hc = abs(squeeze(freqresp(N1*H1c, freqs, 'Hz'))).^2+abs(squeeze(freqresp(N2*H2c, freqs, 'Hz'))).^2;
CPS_Hc = 1/pi*cumtrapz(2*pi*freqs, PSD_Hc);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfa66e55" class="outline-3">
<h3 id="orgfa66e55"><span class="section-number-3">2.8</span> Comparison of the methods</h3>
<div class="outline-text-3" id="text-2-8">
<p>
The three methods are now compared.
</p>
<p>
The Power Spectral Density of the super sensors obtained with the complementary filters designed using the three methods are shown in Fig. <a href="#orgf151d00">22</a>.
</p>
<p>
The Cumulative Power Spectrum for the same sensors are shown on Fig. <a href="#org849ab7e">23</a>.
</p>
<p>
The RMS value of the obtained super sensors are shown on table <a href="#org21af292">1</a>.
</p>
<table id="org21af292" border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<caption class="t-above"><span class="table-number">Table 1:</span> RMS value of the estimation error when using the sensor individually and when using the two sensor merged using the optimal complementary filters</caption>
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">rms value</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Sensor 1</td>
<td class="org-right">1.3e-03</td>
</tr>
<tr>
<td class="org-left">Sensor 2</td>
<td class="org-right">1.3e-03</td>
</tr>
<tr>
<td class="org-left">H2 Fusion</td>
<td class="org-right">1.2e-04</td>
</tr>
<tr>
<td class="org-left">H-Infinity a</td>
<td class="org-right">2.4e-04</td>
</tr>
<tr>
<td class="org-left">H-Infinity b</td>
<td class="org-right">1.4e-04</td>
</tr>
<tr>
<td class="org-left">H-Infinity c</td>
<td class="org-right">2.2e-04</td>
</tr>
</tbody>
</table>
<div id="orgf151d00" class="figure">
<p><img src="figs/comparison_psd_noise.png" alt="comparison_psd_noise.png" />
</p>
<p><span class="figure-number">Figure 22: </span>Comparison of the obtained Power Spectral Density using the three methods (<a href="./figs/comparison_psd_noise.png">png</a>, <a href="./figs/comparison_psd_noise.pdf">pdf</a>)</p>
</div>
<div id="org849ab7e" class="figure">
<p><img src="figs/comparison_cps_noise.png" alt="comparison_cps_noise.png" />
</p>
<p><span class="figure-number">Figure 23: </span>Comparison of the obtained Cumulative Power Spectrum using the three methods (<a href="./figs/comparison_cps_noise.png">png</a>, <a href="./figs/comparison_cps_noise.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgc0725f0" class="outline-3">
<h3 id="orgc0725f0"><span class="section-number-3">2.9</span> Obtained Super Sensor&rsquo;s noise uncertainty</h3>
<div class="outline-text-3" id="text-2-9">
<p>
We would like to verify if the obtained sensor fusion architecture is robust to change in the sensor dynamics.
</p>
<p>
To study the dynamical uncertainty on the super sensor, we defined some multiplicative uncertainty on both sensor dynamics.
Two weights \(w_1(s)\) and \(w_2(s)\) are used to described the amplitude of the dynamical uncertainty.
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 0.1; Ginf = 10;
w1 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1;
w2 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 5000*2*pi; G0 = 1; Ginf = 50;
w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1);
</pre>
</div>
<p>
The sensor uncertain models are defined below.
</p>
<div class="org-src-container">
<pre class="src src-matlab">G1 = 1 + w1*ultidyn('Delta',[1 1]);
G2 = 1 + w2*ultidyn('Delta',[1 1]);
</pre>
</div>
<p>
The super sensor uncertain model is defined below using the complementary filters obtained with the \(\mathcal{H}_2\) synthesis.
The dynamical uncertainty bounds of the super sensor is shown in Fig. <a href="#org112b401">24</a>.
Right Half Plane zero might be introduced in the super sensor dynamics which will render the feedback system unstable.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Gss = G1*H1 + G2*H2;
</pre>
</div>
<div id="org112b401" class="figure">
<p><img src="figs/uncertainty_super_sensor_H2_syn.png" alt="uncertainty_super_sensor_H2_syn.png" />
</p>
<p><span class="figure-number">Figure 24: </span>Uncertianty regions of both individual sensors and of the super sensor when using the \(\mathcal{H}_2\) synthesis (<a href="./figs/uncertainty_super_sensor_H2_syn.png">png</a>, <a href="./figs/uncertainty_super_sensor_H2_syn.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgd9e14cc" class="outline-3">
<h3 id="orgd9e14cc"><span class="section-number-3">2.10</span> Conclusion</h3>
<div class="outline-text-3" id="text-2-10">
<p>
From the above complementary filter design with the \(\mathcal{H}_2\) and \(\mathcal{H}_\infty\) synthesis, it still seems that the \(\mathcal{H}_2\) synthesis gives the complementary filters that permits to obtain the minimal super sensor noise (when measuring with the \(\mathcal{H}_2\) norm).
</p>
<p>
However, the synthesis does not take into account the robustness of the sensor fusion.
</p>
</div>
</div>
</div>
<div id="outline-container-org973040c" class="outline-2">
<h2 id="org973040c"><span class="section-number-2">3</span> Optimal Sensor Fusion - Minimize the Super Sensor Dynamical Uncertainty</h2>
<div class="outline-text-2" id="text-3">
<p>
<a id="org5315886"></a>
</p>
<p>
We initially considered perfectly known sensor dynamics so that it can be perfectly inverted.
</p>
<p>
We now take into account the fact that the sensor dynamics is only partially known.
To do so, we model the uncertainty that we have on the sensor dynamics by multiplicative input uncertainty as shown in Fig. <a href="#org2bcfc52">25</a>.
</p>
<div id="org2bcfc52" class="figure">
<p><img src="figs-tikz/sensor_fusion_dynamic_uncertainty.png" alt="sensor_fusion_dynamic_uncertainty.png" />
</p>
<p><span class="figure-number">Figure 25: </span>Sensor fusion architecture with sensor dynamics uncertainty</p>
</div>
<p>
The objective here is to design complementary filters \(H_1(s)\) and \(H_2(s)\) in order to minimize the dynamical uncertainty of the super sensor.
</p>
<div class="note">
<p>
The Matlab scripts is accessible <a href="matlab/comp_filter_robustness.m">here</a>.
</p>
</div>
</div>
<div id="outline-container-org484d6ba" class="outline-3">
<h3 id="org484d6ba"><span class="section-number-3">3.1</span> Super Sensor Dynamical Uncertainty</h3>
<div class="outline-text-3" id="text-3-1">
<p>
In practical systems, the sensor dynamics has always some level of uncertainty.
Let&rsquo;s represent that with multiplicative input uncertainty as shown on figure <a href="#org2bcfc52">25</a>.
</p>
<div id="orgbdcb9e9" class="figure">
<p><img src="figs-tikz/sensor_fusion_dynamic_uncertainty.png" alt="sensor_fusion_dynamic_uncertainty.png" />
</p>
<p><span class="figure-number">Figure 26: </span>Fusion of two sensors with input multiplicative uncertainty</p>
</div>
<p>
The dynamics of the super sensor is represented by
</p>
\begin{align*}
\frac{\hat{x}}{x} &= (1 + w_1 \Delta_1) H_1 + (1 + w_2 \Delta_2) H_2 \\
&= 1 + w_1 H_1 \Delta_1 + w_2 H_2 \Delta_2
\end{align*}
<p>
with \(\Delta_i\) is any transfer function satisfying \(\| \Delta_i \|_\infty < 1\).
</p>
<p>
We see that as soon as we have some uncertainty in the sensor dynamics, we have that the complementary filters have some effect on the transfer function from \(x\) to \(\hat{x}\).
</p>
<p>
The uncertainty set of the transfer function from \(\hat{x}\) to \(x\) at frequency \(\omega\) is bounded in the complex plane by a circle centered on 1 and with a radius equal to \(|w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)|\) (figure <a href="#org3a66827">27</a>).
</p>
<p>
We then have that the angle introduced by the super sensor is bounded by \(\arcsin(\epsilon)\):
\[ \angle \frac{\hat{x}}{x}(j\omega) \le \arcsin \Big(|w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)|\Big) \]
</p>
<div id="org3a66827" class="figure">
<p><img src="figs-tikz/uncertainty_gain_phase_variation.png" alt="uncertainty_gain_phase_variation.png" />
</p>
<p><span class="figure-number">Figure 27: </span>Maximum phase variation</p>
</div>
</div>
</div>
<div id="outline-container-org427c0ac" class="outline-3">
<h3 id="org427c0ac"><span class="section-number-3">3.2</span> Dynamical uncertainty of the individual sensors</h3>
<div class="outline-text-3" id="text-3-2">
<p>
Let say we want to merge two sensors:
</p>
<ul class="org-ul">
<li>sensor 1 that has unknown dynamics above 10Hz: \(|w_1(j\omega)| > 1\) for \(\omega > 10\text{ Hz}\)</li>
<li>sensor 2 that has unknown dynamics below 1Hz and above 1kHz \(|w_2(j\omega)| > 1\) for \(\omega < 1\text{ Hz}\) and \(\omega > 1\text{ kHz}\)</li>
</ul>
<p>
We define the weights that are used to characterize the dynamic uncertainty of the sensors.
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 0.1; Ginf = 10;
w1 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1;
w2 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 5000*2*pi; G0 = 1; Ginf = 50;
w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1);
</pre>
</div>
<p>
From the weights, we define the uncertain transfer functions of the sensors. Some of the uncertain dynamics of both sensors are shown on Fig. <a href="#org8e13b3b">28</a> with the upper and lower bounds on the magnitude and on the phase.
</p>
<div class="org-src-container">
<pre class="src src-matlab">G1 = 1 + w1*ultidyn('Delta',[1 1]);
G2 = 1 + w2*ultidyn('Delta',[1 1]);
</pre>
</div>
<div id="org8e13b3b" class="figure">
<p><img src="figs/uncertainty_dynamics_sensors.png" alt="uncertainty_dynamics_sensors.png" />
</p>
<p><span class="figure-number">Figure 28: </span>Dynamic uncertainty of the two sensors (<a href="./figs/uncertainty_dynamics_sensors.png">png</a>, <a href="./figs/uncertainty_dynamics_sensors.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgb611d39" class="outline-3">
<h3 id="orgb611d39"><span class="section-number-3">3.3</span> Synthesis objective</h3>
<div class="outline-text-3" id="text-3-3">
<p>
The uncertainty region of the super sensor dynamics is represented by a circle in the complex plane as shown in Fig. <a href="#org3a66827">27</a>.
</p>
<p>
At each frequency \(\omega\), the radius of the circle is \(|w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)|\).
</p>
<p>
Thus, the phase shift \(\Delta\phi(\omega)\) due to the super sensor uncertainty is bounded by:
\[ |\Delta\phi(\omega)| \leq \arcsin\big( |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| \big) \]
</p>
<p>
Let&rsquo;s define some allowed frequency depend phase shift \(\Delta\phi_\text{max}(\omega) > 0\) such that:
\[ |\Delta\phi(\omega)| < \Delta\phi_\text{max}(\omega), \quad \forall\omega \]
</p>
<p>
If \(H_1(s)\) and \(H_2(s)\) are designed such that
\[ |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| < \sin\big( \Delta\phi_\text{max}(\omega) \big) \]
</p>
<p>
The maximum phase shift due to dynamic uncertainty at frequency \(\omega\) will be \(\Delta\phi_\text{max}(\omega)\).
</p>
</div>
</div>
<div id="outline-container-orgff5adc0" class="outline-3">
<h3 id="orgff5adc0"><span class="section-number-3">3.4</span> Requirements as an \(\mathcal{H}_\infty\) norm</h3>
<div class="outline-text-3" id="text-3-4">
<p>
We now try to express this requirement in terms of an \(\mathcal{H}_\infty\) norm.
</p>
<p>
Let&rsquo;s define one weight \(w_\phi(s)\) that represents the maximum wanted phase uncertainty:
\[ |w_{\phi}(j\omega)|^{-1} \approx \sin(\Delta\phi_{\text{max}}(\omega)), \quad \forall\omega \]
</p>
<p>
Then:
</p>
\begin{align*}
& |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| < \sin\big( \Delta\phi_\text{max}(\omega) \big), \quad \forall\omega \\
\Longleftrightarrow & |w_1(j\omega) H_1(j\omega)| + |w_2(j\omega) H_2(j\omega)| < |w_\phi(j\omega)|^{-1}, \quad \forall\omega \\
\Longleftrightarrow & \left| w_1(j\omega) H_1(j\omega) w_\phi(j\omega) \right| + \left| w_2(j\omega) H_2(j\omega) w_\phi(j\omega) \right| < 1, \quad \forall\omega
\end{align*}
<p>
Which is approximately equivalent to (with an error of maximum \(\sqrt{2}\)):
</p>
\begin{equation}
\label{org6b95a9d}
\left\| \begin{matrix} w_1(s) w_\phi(s) H_1(s) \\ w_2(s) w_\phi(s) H_2(s) \end{matrix} \right\|_\infty < 1
\end{equation}
<p>
One should not forget that at frequency where both sensors has unknown dynamics (\(|w_1(j\omega)| > 1\) and \(|w_2(j\omega)| > 1\)), the super sensor dynamics will also be unknown and the phase uncertainty cannot be bounded.
Thus, at these frequencies, \(|w_\phi|\) should be smaller than \(1\).
</p>
</div>
</div>
<div id="outline-container-orga726980" class="outline-3">
<h3 id="orga726980"><span class="section-number-3">3.5</span> Weighting Function used to bound the super sensor uncertainty</h3>
<div class="outline-text-3" id="text-3-5">
<p>
Let&rsquo;s define \(w_\phi(s)\) in order to bound the maximum allowed phase uncertainty \(\Delta\phi_\text{max}\) of the super sensor dynamics.
The magnitude \(|w_\phi(j\omega)|\) is shown in Fig. <a href="#org21523b9">29</a> and the corresponding maximum allowed phase uncertainty of the super sensor dynamics of shown in Fig. <a href="#org5ca851f">30</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Dphi = 20; % [deg]
n = 4; w0 = 2*pi*900; G0 = 1/sin(Dphi*pi/180); Ginf = 1/100; Gc = 1;
wphi = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/Ginf)^(2/n)))*s + (G0/Gc)^(1/n))/((1/Ginf)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/Ginf)^(2/n)))*s + (1/Gc)^(1/n)))^n;
W1 = w1*wphi;
W2 = w2*wphi;
</pre>
</div>
<div id="org21523b9" class="figure">
<p><img src="figs/magnitude_wphi.png" alt="magnitude_wphi.png" />
</p>
<p><span class="figure-number">Figure 29: </span>Magnitude of the weght \(w_\phi(s)\) that is used to bound the uncertainty of the super sensor (<a href="./figs/magnitude_wphi.png">png</a>, <a href="./figs/magnitude_wphi.pdf">pdf</a>)</p>
</div>
<div id="org5ca851f" class="figure">
<p><img src="figs/maximum_wanted_phase_uncertainty.png" alt="maximum_wanted_phase_uncertainty.png" />
</p>
<p><span class="figure-number">Figure 30: </span>Maximum wanted phase uncertainty using this weight (<a href="./figs/maximum_wanted_phase_uncertainty.png">png</a>, <a href="./figs/maximum_wanted_phase_uncertainty.pdf">pdf</a>)</p>
</div>
<p>
The obtained upper bounds on the complementary filters in order to limit the phase uncertainty of the super sensor are represented in Fig. <a href="#org934d52b">31</a>.
</p>
<div id="org934d52b" class="figure">
<p><img src="figs/upper_bounds_comp_filter_max_phase_uncertainty.png" alt="upper_bounds_comp_filter_max_phase_uncertainty.png" />
</p>
<p><span class="figure-number">Figure 31: </span>Upper bounds on the complementary filters set in order to limit the maximum phase uncertainty of the super sensor to 30 degrees until 500Hz (<a href="./figs/upper_bounds_comp_filter_max_phase_uncertainty.png">png</a>, <a href="./figs/upper_bounds_comp_filter_max_phase_uncertainty.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgb744213" class="outline-3">
<h3 id="orgb744213"><span class="section-number-3">3.6</span> \(\mathcal{H}_\infty\) Synthesis</h3>
<div class="outline-text-3" id="text-3-6">
<p>
The \(\mathcal{H}_\infty\) synthesis architecture used for the complementary filters is shown in Fig. <a href="#org2a65e7b">32</a>.
</p>
<div id="org2a65e7b" class="figure">
<p><img src="figs-tikz/h_infinity_robust_fusion.png" alt="h_infinity_robust_fusion.png" />
</p>
<p><span class="figure-number">Figure 32: </span>Architecture used for \(\mathcal{H}_\infty\) synthesis of complementary filters</p>
</div>
<p>
The generalized plant is defined below.
</p>
<div class="org-src-container">
<pre class="src src-matlab">P = [W1 -W1;
0 W2;
1 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_\infty\) synthesis using the <code>hinfsyn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
</pre>
</div>
<pre class="example">
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
Resetting value of Gamma min based on D_11, D_12, D_21 terms
Test bounds: 0.0447 &lt; gamma &lt;= 1.3318
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
1.332 1.3e+01 -1.0e-14 1.3e+00 -2.6e-18 0.0000 p
0.688 1.3e-11# ******** 1.3e+00 -6.7e-15 ******** f
1.010 1.1e+01 -1.5e-14 1.3e+00 -2.5e-14 0.0000 p
0.849 6.9e-11# ******** 1.3e+00 -2.3e-14 ******** f
0.930 5.2e-12# ******** 1.3e+00 -6.1e-18 ******** f
0.970 5.6e-11# ******** 1.3e+00 -2.3e-14 ******** f
0.990 5.0e-11# ******** 1.3e+00 -1.7e-17 ******** f
1.000 2.1e-10# ******** 1.3e+00 0.0e+00 ******** f
1.005 1.9e-10# ******** 1.3e+00 -3.7e-14 ******** f
1.008 1.1e+01 -9.1e-15 1.3e+00 0.0e+00 0.0000 p
1.006 1.2e-09# ******** 1.3e+00 -6.9e-16 ******** f
1.007 1.1e+01 -4.6e-15 1.3e+00 -1.8e-16 0.0000 p
Gamma value achieved: 1.0069
</pre>
<p>
And \(H_1(s)\) is defined as the complementary of \(H_2(s)\).
</p>
<div class="org-src-container">
<pre class="src src-matlab">H1 = 1 - H2;
</pre>
</div>
<p>
The obtained complementary filters are shown in Fig. <a href="#org5c72357">33</a>.
</p>
<div id="org5c72357" class="figure">
<p><img src="figs/comp_filter_hinf_uncertainty.png" alt="comp_filter_hinf_uncertainty.png" />
</p>
<p><span class="figure-number">Figure 33: </span>Obtained complementary filters (<a href="./figs/comp_filter_hinf_uncertainty.png">png</a>, <a href="./figs/comp_filter_hinf_uncertainty.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org70db455" class="outline-3">
<h3 id="org70db455"><span class="section-number-3">3.7</span> Super sensor uncertainty</h3>
<div class="outline-text-3" id="text-3-7">
<p>
We can now compute the uncertainty of the super sensor. The result is shown in Fig. <a href="#orgf84de6e">34</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Gss = G1*H1 + G2*H2;
</pre>
</div>
<div id="orgf84de6e" class="figure">
<p><img src="figs/super_sensor_uncertainty_bode_plot.png" alt="super_sensor_uncertainty_bode_plot.png" />
</p>
<p><span class="figure-number">Figure 34: </span>Uncertainty on the dynamics of the super sensor (<a href="./figs/super_sensor_uncertainty_bode_plot.png">png</a>, <a href="./figs/super_sensor_uncertainty_bode_plot.pdf">pdf</a>)</p>
</div>
<p>
The uncertainty of the super sensor cannot be made smaller than both the individual sensor. Ideally, it would follow the minimum uncertainty of both sensors.
</p>
<p>
We here just used very wimple weights.
For instance, we could improve the dynamical uncertainty of the super sensor by making \(|w_\phi(j\omega)|\) smaller bellow 2Hz where the dynamical uncertainty of the sensor 1 is small.
</p>
</div>
</div>
<div id="outline-container-org7adfdd3" class="outline-3">
<h3 id="org7adfdd3"><span class="section-number-3">3.8</span> Super sensor noise</h3>
<div class="outline-text-3" id="text-3-8">
<p>
We now compute the obtain Power Spectral Density of the super sensor&rsquo;s noise.
The noise characteristics of both individual sensor are defined below.
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4;
N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100);
omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8;
N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
</pre>
</div>
<p>
The PSD of both sensor and of the super sensor is shown in Fig. <a href="#org1e50e04">35</a>.
The CPS of both sensor and of the super sensor is shown in Fig. <a href="#org58a0904">36</a>.
</p>
<div id="org1e50e04" class="figure">
<p><img src="figs/psd_sensors_hinf_synthesis.png" alt="psd_sensors_hinf_synthesis.png" />
</p>
<p><span class="figure-number">Figure 35: </span>Power Spectral Density of the obtained super sensor using the \(\mathcal{H}_\infty\) synthesis (<a href="./figs/psd_sensors_hinf_synthesis.png">png</a>, <a href="./figs/psd_sensors_hinf_synthesis.pdf">pdf</a>)</p>
</div>
<div id="org58a0904" class="figure">
<p><img src="figs/cps_sensors_hinf_synthesis.png" alt="cps_sensors_hinf_synthesis.png" />
</p>
<p><span class="figure-number">Figure 36: </span>Cumulative Power Spectrum of the obtained super sensor using the \(\mathcal{H}_\infty\) synthesis (<a href="./figs/cps_sensors_hinf_synthesis.png">png</a>, <a href="./figs/cps_sensors_hinf_synthesis.cps">cps</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgcfc9f63" class="outline-3">
<h3 id="orgcfc9f63"><span class="section-number-3">3.9</span> Conclusion</h3>
<div class="outline-text-3" id="text-3-9">
<p>
Using the \(\mathcal{H}_\infty\) synthesis, the dynamical uncertainty of the super sensor can be bounded to acceptable values.
</p>
<p>
However, the RMS of the super sensor noise is not optimized as it was the case with the \(\mathcal{H}_2\) synthesis
</p>
</div>
</div>
</div>
<div id="outline-container-org0a911c7" class="outline-2">
<h2 id="org0a911c7"><span class="section-number-2">4</span> Optimal Sensor Fusion - Mixed Synthesis</h2>
<div class="outline-text-2" id="text-4">
<p>
<a id="org05cb81a"></a>
</p>
<div class="note">
<p>
The Matlab scripts is accessible <a href="matlab/mixed_synthesis_sensor_fusion.m">here</a>.
</p>
</div>
</div>
<div id="outline-container-org1539be0" class="outline-3">
<h3 id="org1539be0"><span class="section-number-3">4.1</span> Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis - Introduction</h3>
<div class="outline-text-3" id="text-4-1">
<p>
The goal is to design complementary filters such that:
</p>
<ul class="org-ul">
<li>the maximum uncertainty of the super sensor is bounded</li>
<li>the RMS value of the super sensor noise is minimized</li>
</ul>
<p>
To do so, we can use the Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis.
</p>
<p>
The Matlab function for that is <code>h2hinfsyn</code> (<a href="https://fr.mathworks.com/help/robust/ref/h2hinfsyn.html">doc</a>).
</p>
</div>
</div>
<div id="outline-container-org2d34714" class="outline-3">
<h3 id="org2d34714"><span class="section-number-3">4.2</span> Noise characteristics and Uncertainty of the individual sensors</h3>
<div class="outline-text-3" id="text-4-2">
<p>
We define the weights that are used to characterize the dynamic uncertainty of the sensors. This will be used for the \(\mathcal{H}_\infty\) part of the synthesis.
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 0.1; Ginf = 10;
w1 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1;
w2 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 5000*2*pi; G0 = 1; Ginf = 50;
w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1);
</pre>
</div>
<p>
We define the noise characteristics of the two sensors by choosing \(N_1\) and \(N_2\). This will be used for the \(\mathcal{H}_2\) part of the synthesis.
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4;
N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100);
omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8;
N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
</pre>
</div>
<p>
Both dynamical uncertainty and noise characteristics of the individual sensors are shown in Fig. <a href="#orgf2f94c4">37</a>.
</p>
<div id="orgf2f94c4" class="figure">
<p><img src="figs/mixed_synthesis_noise_uncertainty_sensors.png" alt="mixed_synthesis_noise_uncertainty_sensors.png" />
</p>
<p><span class="figure-number">Figure 37: </span>Noise characteristsics and Dynamical uncertainty of the individual sensors (<a href="./figs/mixed_synthesis_noise_uncertainty_sensors.png">png</a>, <a href="./figs/mixed_synthesis_noise_uncertainty_sensors.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org09ad6ba" class="outline-3">
<h3 id="org09ad6ba"><span class="section-number-3">4.3</span> Weighting Functions on the uncertainty of the super sensor</h3>
<div class="outline-text-3" id="text-4-3">
<p>
We design weights for the \(\mathcal{H}_\infty\) part of the synthesis in order to limit the dynamical uncertainty of the super sensor.
The maximum wanted multiplicative uncertainty is shown in Fig. <a href="#org02d1a9c">38</a>. The idea here is that we don&rsquo;t really need low uncertainty at low frequency but only near the crossover frequency that is suppose to be around 300Hz here.
</p>
<div class="org-src-container">
<pre class="src src-matlab">n = 4; w0 = 2*pi*900; G0 = 9; G1 = 1; Gc = 1.1;
H = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
wphi = 0.2*(s+3.142e04)/(s+628.3)/H;
</pre>
</div>
<div id="org02d1a9c" class="figure">
<p><img src="figs/mixed_syn_hinf_weight.png" alt="mixed_syn_hinf_weight.png" />
</p>
<p><span class="figure-number">Figure 38: </span>Wanted maximum module uncertainty of the super sensor (<a href="./figs/mixed_syn_hinf_weight.png">png</a>, <a href="./figs/mixed_syn_hinf_weight.pdf">pdf</a>)</p>
</div>
<p>
The equivalent Magnitude and Phase uncertainties are shown in Fig. <a href="#org3c726f6">39</a>.
</p>
<div id="org3c726f6" class="figure">
<p><img src="figs/mixed_syn_objective_hinf.png" alt="mixed_syn_objective_hinf.png" />
</p>
<p><span class="figure-number">Figure 39: </span>\(\mathcal{H}_\infty\) synthesis objective part of the mixed-synthesis (<a href="./figs/mixed_syn_objective_hinf.png">png</a>, <a href="./figs/mixed_syn_objective_hinf.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org0e50719" class="outline-3">
<h3 id="org0e50719"><span class="section-number-3">4.4</span> Mixed Synthesis Architecture</h3>
<div class="outline-text-3" id="text-4-4">
<p>
The synthesis architecture that is used here is shown in Fig. <a href="#org34cd0c8">40</a>.
</p>
<p>
The controller \(K\) is synthesized such that it:
</p>
<ul class="org-ul">
<li>Keeps the \(\mathcal{H}_\infty\) norm \(G\) of the transfer function from \(w\) to \(z_\infty\) bellow some specified value</li>
<li>Keeps the \(\mathcal{H}_2\) norm \(H\) of the transfer function from \(w\) to \(z_2\) bellow some specified value</li>
<li>Minimizes a trade-off criterion of the form \(W_1 G^2 + W_2 H^2\) where \(W_1\) and \(W_2\) are specified values</li>
</ul>
<div id="org34cd0c8" class="figure">
<p><img src="figs-tikz/mixed_h2_hinf_synthesis.png" alt="mixed_h2_hinf_synthesis.png" />
</p>
<p><span class="figure-number">Figure 40: </span>Mixed H2/H-Infinity Synthesis</p>
</div>
<p>
Here, we define \(P\) such that:
</p>
\begin{align*}
\left\| \frac{z_\infty}{w} \right\|_\infty &= \left\| \begin{matrix}W_1(s) H_1(s) \\ W_2(s) H_2(s)\end{matrix} \right\|_\infty \\
\left\| \frac{z_2}{w} \right\|_2 &= \left\| \begin{matrix}N_1(s) H_1(s) \\ N_2(s) H_2(s)\end{matrix} \right\|_2
\end{align*}
<p>
Then:
</p>
<ul class="org-ul">
<li>we specify the maximum value for the \(\mathcal{H}_\infty\) norm between \(w\) and \(z_\infty\) to be \(1\)</li>
<li>we don&rsquo;t specify any maximum value for the \(\mathcal{H}_2\) norm between \(w\) and \(z_2\)</li>
<li>we choose \(W_1 = 0\) and \(W_2 = 1\) such that the objective is to minimize the \(\mathcal{H}_2\) norm between \(w\) and \(z_2\)</li>
</ul>
<p>
The synthesis objective is to have:
\[ \left\| \frac{z_\infty}{w} \right\|_\infty = \left\| \begin{matrix}W_1(s) H_1(s) \\ W_2(s) H_2(s)\end{matrix} \right\|_\infty < 1 \]
and to minimize:
\[ \left\| \frac{z_2}{w} \right\|_2 = \left\| \begin{matrix}N_1(s) H_1(s) \\ N_2(s) H_2(s)\end{matrix} \right\|_2 \]
which is what we wanted.
</p>
<p>
We define the generalized plant that will be used for the mixed synthesis.
</p>
<div class="org-src-container">
<pre class="src src-matlab">W1u = ss(w1*wphi); W2u = ss(w2*wphi); % Weight on the uncertainty
W1n = ss(N1); W2n = ss(N2); % Weight on the noise
P = [W1u -W1u;
0 W2u;
W1n -W1n;
0 W2n;
1 0];
</pre>
</div>
</div>
</div>
<div id="outline-container-orgfd2638d" class="outline-3">
<h3 id="orgfd2638d"><span class="section-number-3">4.5</span> Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis</h3>
<div class="outline-text-3" id="text-4-5">
<p>
The mixed \(\mathcal{H}_2/\mathcal{H}_\infty\) synthesis is performed below.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Nmeas = 1; Ncon = 1; Nz2 = 2;
[H2,~,normz,~] = h2hinfsyn(P, Nmeas, Ncon, Nz2, [0, 1], 'HINFMAX', 1, 'H2MAX', Inf, 'DKMAX', 100, 'TOL', 0.01, 'DISPLAY', 'on');
H1 = 1 - H2;
</pre>
</div>
<p>
The obtained complementary filters are shown in Fig. <a href="#orga6775c7">41</a>.
</p>
<div id="orga6775c7" class="figure">
<p><img src="figs/comp_filters_mixed_synthesis.png" alt="comp_filters_mixed_synthesis.png" />
</p>
<p><span class="figure-number">Figure 41: </span>Obtained complementary filters after mixed \(\mathcal{H}_2/\mathcal{H}_\infty\) synthesis (<a href="./figs/comp_filters_mixed_synthesis.png">png</a>, <a href="./figs/comp_filters_mixed_synthesis.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org42d85ce" class="outline-3">
<h3 id="org42d85ce"><span class="section-number-3">4.6</span> Obtained Super Sensor&rsquo;s noise</h3>
<div class="outline-text-3" id="text-4-6">
<p>
The PSD and CPS of the super sensor&rsquo;s noise are shown in Fig. <a href="#org1b3b298">42</a> and Fig. <a href="#org4579b02">43</a> respectively.
</p>
<div id="org1b3b298" class="figure">
<p><img src="figs/psd_super_sensor_mixed_syn.png" alt="psd_super_sensor_mixed_syn.png" />
</p>
<p><span class="figure-number">Figure 42: </span>Power Spectral Density of the Super Sensor obtained with the mixed \(\mathcal{H}_2/\mathcal{H}_\infty\) synthesis (<a href="./figs/psd_super_sensor_mixed_syn.png">png</a>, <a href="./figs/psd_super_sensor_mixed_syn.pdf">pdf</a>)</p>
</div>
<div id="org4579b02" class="figure">
<p><img src="figs/cps_super_sensor_mixed_syn.png" alt="cps_super_sensor_mixed_syn.png" />
</p>
<p><span class="figure-number">Figure 43: </span>Cumulative Power Spectrum of the Super Sensor obtained with the mixed \(\mathcal{H}_2/\mathcal{H}_\infty\) synthesis (<a href="./figs/cps_super_sensor_mixed_syn.png">png</a>, <a href="./figs/cps_super_sensor_mixed_syn.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org9e9b963" class="outline-3">
<h3 id="org9e9b963"><span class="section-number-3">4.7</span> Obtained Super Sensor&rsquo;s Uncertainty</h3>
<div class="outline-text-3" id="text-4-7">
<p>
The uncertainty on the super sensor&rsquo;s dynamics is shown in Fig. <a href="#orgda28404">44</a>.
</p>
<div id="orgda28404" class="figure">
<p><img src="figs/super_sensor_dyn_uncertainty_mixed_syn.png" alt="super_sensor_dyn_uncertainty_mixed_syn.png" />
</p>
<p><span class="figure-number">Figure 44: </span>Super Sensor Dynamical Uncertainty obtained with the mixed synthesis (<a href="./figs/super_sensor_dyn_uncertainty_mixed_syn.png">png</a>, <a href="./figs/super_sensor_dyn_uncertainty_mixed_syn.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgf6e9530" class="outline-3">
<h3 id="orgf6e9530"><span class="section-number-3">4.8</span> Conclusion</h3>
<div class="outline-text-3" id="text-4-8">
<p>
This synthesis methods allows both to:
</p>
<ul class="org-ul">
<li>limit the dynamical uncertainty of the super sensor</li>
<li>minimize the RMS value of the estimation</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-orge39201f" class="outline-2">
<h2 id="orge39201f"><span class="section-number-2">5</span> Mixed Synthesis - LMI Optimization</h2>
<div class="outline-text-2" id="text-5">
</div>
<div id="outline-container-org95d320e" class="outline-3">
<h3 id="org95d320e"><span class="section-number-3">5.1</span> Introduction</h3>
<div class="outline-text-3" id="text-5-1">
<p>
The following matlab scripts was written by Mohit.
</p>
</div>
</div>
<div id="outline-container-org4b60f6e" class="outline-3">
<h3 id="org4b60f6e"><span class="section-number-3">5.2</span> Noise characteristics and Uncertainty of the individual sensors</h3>
<div class="outline-text-3" id="text-5-2">
<p>
We define the weights that are used to characterize the dynamic uncertainty of the sensors. This will be used for the \(\mathcal{H}_\infty\) part of the synthesis.
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 0.1; Ginf = 10;
w1 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1;
w2 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 5000*2*pi; G0 = 1; Ginf = 50;
w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1);
</pre>
</div>
<p>
We define the noise characteristics of the two sensors by choosing \(N_1\) and \(N_2\). This will be used for the \(\mathcal{H}_2\) part of the synthesis.
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4;
N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100);
omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8;
N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
</pre>
</div>
</div>
</div>
<div id="outline-container-org422d4ca" class="outline-3">
<h3 id="org422d4ca"><span class="section-number-3">5.3</span> Weights</h3>
<div class="outline-text-3" id="text-5-3">
<p>
The weights for the \(\mathcal{H}_2\) and \(\mathcal{H}_\infty\) part are defined below.
</p>
<div class="org-src-container">
<pre class="src src-matlab">n = 4; w0 = 2*pi*900; G0 = 9; G1 = 1; Gc = 1.1;
H = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
wphi = 0.2*(s+3.142e04)/(s+628.3)/H;
W1u = ss(w1*wphi); W2u = ss(w2*wphi); % Weight on the uncertainty
W1n = ss(N1); W2n = ss(N2); % Weight on the noise
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">P = [W1u -W1u;
0 W2u;
W1n -W1n;
0 W2n;
1 0];
</pre>
</div>
</div>
</div>
<div id="outline-container-org1890686" class="outline-3">
<h3 id="org1890686"><span class="section-number-3">5.4</span> LMI Optimization</h3>
<div class="outline-text-3" id="text-5-4">
<p>
We are using the <a href="http://cvxr.com/cvx/">CVX toolbox</a> to solve the optimization problem.
</p>
<p>
We first put the generalized plant in a State-space form.
</p>
<div class="org-src-container">
<pre class="src src-matlab">A = P.A;
Bw = P.B(:,1);
Bu = P.B(:,2);
Cz1 = P.C(1:2,:); Dz1w = P.D(1:2,1); Dz1u = P.D(1:2,2); % Hinf
Cz2 = P.C(3:4,:); Dz2w = P.D(1:2,1); Dz2u = P.D(1:2,2); % H2
Cy = P.C(5,:); Dyw = P.D(5,1); Dyu = P.D(5,2);
n = size(P.A,1);
ny = 1; % number of measurements
nu = 1; % number of control inputs
nz = 2;
nw = 1;
Wtinf = 0;
Wt2 = 1;
</pre>
</div>
<p>
We Define all the variables.
</p>
<div class="org-src-container">
<pre class="src src-matlab">cvx_startup;
cvx_begin sdp
cvx_quiet true
cvx_solver sedumi
variable X(n,n) symmetric;
variable Y(n,n) symmetric;
variable W(nz,nz) symmetric;
variable Ah(n,n);
variable Bh(n,ny);
variable Ch(nu,n);
variable Dh(nu,ny);
variable eta;
variable gam;
</pre>
</div>
<p>
We define the minimization objective.
</p>
<div class="org-src-container">
<pre class="src src-matlab">minimize Wt2*eta+Wtinf*gam % mix objective
subject to:
</pre>
</div>
<p>
The \(\mathcal{H}_\infty\) constraint.
</p>
<div class="org-src-container">
<pre class="src src-matlab">gam&lt;=1; % Keep the Hinf norm less than 1
[ X, eye(n,n) ;
eye(n,n), Y ] &gt;= 0 ;
[ A*X + Bu*Ch + X*A' + Ch'*Bu', A+Bu*Dh*Cy+Ah', Bw+Bu*Dh*Dyw, X*Cz1' + Ch'*Dz1u' ;
(A+Bu*Dh*Cy+Ah')', Y*A + A'*Y + Bh*Cy + Cy'*Bh', Y*Bw + Bh*Dyw, (Cz1+Dz1u*Dh*Cy)' ;
(Bw+Bu*Dh*Dyw)', Bw'*Y + Dyw'*Bh', -eye(nw,nw), (Dz1w+Dz1u*Dh*Dyw)' ;
Cz1*X + Dz1u*Ch, Cz1+Dz1u*Dh*Cy, Dz1w+Dz1u*Dh*Dyw, -gam*eye(nz,nz)] &lt;= 0 ;
</pre>
</div>
<p>
The \(\mathcal{H}_2\) constraint.
</p>
<div class="org-src-container">
<pre class="src src-matlab">trace(W) &lt;= eta ;
[ W, Cz2*X+Dz2u*Ch, Cz2*X+Dz2u*Ch;
X*Cz2'+Ch'*Dz2u', X, eye(n,n) ;
(Cz2*X+Dz2u*Ch)', eye(n,n), Y ] &gt;= 0 ;
[ A*X + Bu*Ch + X*A' + Ch'*Bu', A+Bu*Dh*Cy+Ah', Bw+Bu*Dh*Dyw ;
(A+Bu*Dh*Cy+Ah')', Y*A + A'*Y + Bh*Cy + Cy'*Bh', Y*Bw + Bh*Dyw ;
(Bw+Bu*Dh*Dyw)', Bw'*Y + Dyw'*Bh', -eye(nw,nw)] &lt;= 0 ;
</pre>
</div>
<p>
And we run the optimization.
</p>
<div class="org-src-container">
<pre class="src src-matlab">cvx_end
cvx_status
</pre>
</div>
<p>
Finally, we can compute the obtained complementary filters.
</p>
<div class="org-src-container">
<pre class="src src-matlab">M = eye(n);
N = inv(M)*(eye(n,n)-Y*X);
Dk = Dh;
Ck = (Ch-Dk*Cy*X)*inv(M');
Bk = inv(N)*(Bh-Y*Bu*Dk);
Ak = inv(N)*(Ah-Y*(A+Bu*Dk*Cy)*X-N*Bk*Cy*X-Y*Bu*Ck*M')*inv(M');
H2 = tf(ss(Ak,Bk,Ck,Dk));
H1 = 1 - H2;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbb11dc7" class="outline-3">
<h3 id="orgbb11dc7"><span class="section-number-3">5.5</span> Result</h3>
<div class="outline-text-3" id="text-5-5">
<p>
The obtained complementary filters are compared with the required upper bounds on Fig. <a href="#orgb9e1cff">45</a>.
</p>
<div id="orgb9e1cff" class="figure">
<p><img src="figs/LMI_obtained_comp_filters.png" alt="LMI_obtained_comp_filters.png" />
</p>
<p><span class="figure-number">Figure 45: </span>Obtained complementary filters using the LMI optimization (<a href="./figs/LMI_obtained_comp_filters.png">png</a>, <a href="./figs/LMI_obtained_comp_filters.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org173a30e" class="outline-3">
<h3 id="org173a30e"><span class="section-number-3">5.6</span> Comparison with the matlab Mixed Synthesis</h3>
<div class="outline-text-3" id="text-5-6">
<p>
The Mixed \(\mathcal{H}_2\) / \(\mathcal{H}_\infty\) Synthesis is performed below.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Nmeas = 1; Ncon = 1; Nz2 = 2;
[H2m,~,normz,~] = h2hinfsyn(P, Nmeas, Ncon, Nz2, [0, 1], 'HINFMAX', 1, 'H2MAX', Inf, 'DKMAX', 100, 'TOL', 0.01, 'DISPLAY', 'on');
H1m = 1 - H2m;
</pre>
</div>
<p>
The obtained filters are compare with the one obtained using the CVX toolbox in Fig. [[]].
</p>
<div id="org862f81c" class="figure">
<p><img src="figs/compare_cvx_h2hinf_comp_filters.png" alt="compare_cvx_h2hinf_comp_filters.png" />
</p>
<p><span class="figure-number">Figure 46: </span>Comparison between the complementary filters obtained with the CVX toolbox and with the <code>h2hinfsyn</code> command (<a href="./figs/compare_cvx_h2hinf_comp_filters.png">png</a>, <a href="./figs/compare_cvx_h2hinf_comp_filters.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgfa73512" class="outline-3">
<h3 id="orgfa73512"><span class="section-number-3">5.7</span> H-Infinity Objective</h3>
<div class="outline-text-3" id="text-5-7">
<p>
In terms of the \(\mathcal{H}_\infty\) objective, both synthesis method are satisfying the requirements as shown in Fig. <a href="#orgea0da02">47</a>.
</p>
<div id="orgea0da02" class="figure">
<p><img src="figs/comp_cvx_h2i_hinf_norm.png" alt="comp_cvx_h2i_hinf_norm.png" />
</p>
<p><span class="figure-number">Figure 47: </span>H-Infinity norm requirement and results (<a href="./figs/comp_cvx_h2i_hinf_norm.png">png</a>, <a href="./figs/comp_cvx_h2i_hinf_norm.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org9ab9eef" class="outline-3">
<h3 id="org9ab9eef"><span class="section-number-3">5.8</span> Obtained Super Sensor&rsquo;s noise</h3>
<div class="outline-text-3" id="text-5-8">
<p>
The PSD and CPS of the super sensor&rsquo;s noise obtained with the CVX toolbox and <code>h2hinfsyn</code> command are compared in Fig. <a href="#org4280336">48</a> and <a href="#org9a95ed4">49</a>.
</p>
<div id="org4280336" class="figure">
<p><img src="figs/psd_compare_cvx_h2i.png" alt="psd_compare_cvx_h2i.png" />
</p>
<p><span class="figure-number">Figure 48: </span>Power Spectral Density of the Super Sensor obtained with the mixed \(\mathcal{H}_2/\mathcal{H}_\infty\) synthesis (<a href="./figs/psd_compare_cvx_h2i.png">png</a>, <a href="./figs/psd_compare_cvx_h2i.pdf">pdf</a>)</p>
</div>
<div id="org9a95ed4" class="figure">
<p><img src="figs/cps_compare_cvx_h2i.png" alt="cps_compare_cvx_h2i.png" />
</p>
<p><span class="figure-number">Figure 49: </span>Cumulative Power Spectrum of the Super Sensor obtained with the mixed \(\mathcal{H}_2/\mathcal{H}_\infty\) synthesis (<a href="./figs/cps_compare_cvx_h2i.png">png</a>, <a href="./figs/cps_compare_cvx_h2i.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orgacf7912" class="outline-3">
<h3 id="orgacf7912"><span class="section-number-3">5.9</span> Obtained Super Sensor&rsquo;s Uncertainty</h3>
<div class="outline-text-3" id="text-5-9">
<p>
The uncertainty on the super sensor&rsquo;s dynamics is shown in Fig. [[]].
</p>
<div id="orgca80f3f" class="figure">
<p><img src="figs/super_sensor_uncertainty_compare_cvx_h2i.png" alt="super_sensor_uncertainty_compare_cvx_h2i.png" />
</p>
<p><span class="figure-number">Figure 50: </span>Super Sensor Dynamical Uncertainty obtained with the mixed synthesis (<a href="./figs/super_sensor_uncertainty_compare_cvx_h2i.png">png</a>, <a href="./figs/super_sensor_uncertainty_compare_cvx_h2i.pdf">pdf</a>)</p>
</div>
</div>
</div>
</div>
<div id="outline-container-org9d71301" class="outline-2">
<h2 id="org9d71301"><span class="section-number-2">6</span> H-Infinity synthesis to ensure both performance and robustness</h2>
<div class="outline-text-2" id="text-6">
<p>
<a id="org5426240"></a>
</p>
<div class="note">
<p>
The Matlab scripts is accessible <a href="matlab/hinf_syn_perf_robust.m">here</a>.
</p>
</div>
</div>
<div id="outline-container-orgedd6d67" class="outline-3">
<h3 id="orgedd6d67"><span class="section-number-3">6.1</span> Introduction</h3>
<div class="outline-text-3" id="text-6-1">
<p>
The idea is to use only the \(\mathcal{H}_\infty\) norm to express both the maximum wanted super sensor uncertainty and the fact that we want to minimize the super sensor&rsquo;s noise.
</p>
<p>
For <b>performance</b>, we may want to obtain a super sensor&rsquo;s noise that is close to the minimum of the individual sensor noises.
</p>
<p>
The noise of the super sensor is:
\[ |N_{ss}(j\omega)|^2 = | H_1(j\omega) N_1(j\omega) |^2 + | H_2(j\omega) N_2(j\omega) |^2 \quad \forall\omega \]
</p>
<p>
The minimum noise that we can obtain follows the minimum noise of the individual sensor:
</p>
\begin{align*}
& |N_{ss}(j\omega)| \approx |N_1(j\omega)| \quad \text{when} \quad |N_1(j\omega)| < |N_2(j\omega)| \\
& |N_{ss}(j\omega)| \approx |N_2(j\omega)| \quad \text{when} \quad |N_2(j\omega)| < |N_1(j\omega)|
\end{align*}
<p>
To do so, we want to design the complementary filters such that:
</p>
\begin{align*}
& |H_2(j\omega)| \ll 1 \quad \text{when} \quad |N_1(j\omega)| < |N_2(j\omega)| \\
& |H_1(j\omega)| \ll 1 \quad \text{when} \quad |N_2(j\omega)| < |N_1(j\omega)|
\end{align*}
<p>
For the <b>uncertainty</b> of the super sensor.
The equivalent super sensor uncertainty is:
\[ |w_{ss}(j\omega)| = |H_1(j\omega) w_1(j\omega)| + |H_2(j\omega) w_2(j\omega)|, \quad \forall\omega \]
</p>
<p>
The minimum uncertainty that we can obtain follows the minimum uncertainty of the individual sensor:
</p>
\begin{align*}
& |w_{ss}(j\omega)| \approx |w_1(j\omega)| \quad \text{when} \quad |w_1(j\omega)| < |w_2(j\omega)| \\
& |w_{ss}(j\omega)| \approx |w_2(j\omega)| \quad \text{when} \quad |w_2(j\omega)| < |w_1(j\omega)|
\end{align*}
<p>
To do so, we want to design the complementary filters such that:
</p>
\begin{align*}
& |H_2(j\omega)| \ll 1 \quad \text{when} \quad |w_1(j\omega)| < |w_2(j\omega)| \\
& |H_1(j\omega)| \ll 1 \quad \text{when} \quad |w_2(j\omega)| < |w_1(j\omega)|
\end{align*}
<p>
Of course, the conditions for performance and uncertainty may not be compatible.
</p>
<p>
We may not want to follow the minimum uncertainty.
</p>
</div>
</div>
<div id="outline-container-orgf783f47" class="outline-3">
<h3 id="orgf783f47"><span class="section-number-3">6.2</span> Dynamical uncertainty and Noise level of the individual sensors</h3>
<div class="outline-text-3" id="text-6-2">
<p>
Uncertainty on the individual sensors:
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 0.1; Ginf = 10;
w1 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 0.2*2*pi; G0 = 5; Ginf = 0.1;
w2 = (Ginf*s/omegac + G0)/(s/omegac + 1);
omegac = 5000*2*pi; G0 = 1; Ginf = 50;
w2 = w2*(Ginf*s/omegac + G0)/(s/omegac + 1);
</pre>
</div>
<p>
Noise level of the individual sensors:
</p>
<div class="org-src-container">
<pre class="src src-matlab">omegac = 100*2*pi; G0 = 1e-5; Ginf = 1e-4;
N1 = (Ginf*s/omegac + G0)/(s/omegac + 1)/(1 + s/2/pi/100);
omegac = 1*2*pi; G0 = 1e-3; Ginf = 1e-8;
N2 = ((sqrt(Ginf)*s/omegac + sqrt(G0))/(s/omegac + 1))^2/(1 + s/2/pi/4000)^2;
</pre>
</div>
<div id="org6c29285" class="figure">
<p><img src="figs/noise_uncertainty_sensors_hinf.png" alt="noise_uncertainty_sensors_hinf.png" />
</p>
<p><span class="figure-number">Figure 51: </span>Noise and Uncertainty characteristics of the sensors (<a href="./figs/noise_uncertainty_sensors_hinf.png">png</a>, <a href="./figs/noise_uncertainty_sensors_hinf.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org2197c97" class="outline-3">
<h3 id="org2197c97"><span class="section-number-3">6.3</span> Weights for uncertainty and performance</h3>
<div class="outline-text-3" id="text-6-3">
<p>
We design weights that are used to describe the wanted upper bound on the super sensor&rsquo;s noise and super sensor&rsquo;s uncertainty.
</p>
<p>
Weight on the uncertainty:
</p>
<div class="org-src-container">
<pre class="src src-matlab">n = 4; w0 = 2*pi*500; G0 = 6; G1 = 1; Gc = 1.1;
H = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
Wu = 0.2*(s+3.142e04)/(s+628.3)/H;
</pre>
</div>
<p>
Weight on the performance:
</p>
<div class="org-src-container">
<pre class="src src-matlab">n = 1; w0 = 2*pi*9; A = 6;
a = sqrt(2*A^(2/n) - 1 + 2*A^(1/n)*sqrt(A^(2/n) - 1));
G = ((1 + s/(w0/a))*(1 + s/(w0*a))/(1 + s/w0)^2)^n;
n = 2; w0 = 2*pi*9; G0 = 1e-2; G1 = 1; Gc = 5e-1;
G2 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
Wp = inv(G2)*inv(G)*inv(N2);
</pre>
</div>
<p>
The noise and uncertainty weights of the individual sensors and the asked noise/uncertainty of the super sensor are displayed in Fig. <a href="#org593ceb8">52</a>.
</p>
<div id="org593ceb8" class="figure">
<p><img src="figs/charac_sensors_weights.png" alt="charac_sensors_weights.png" />
</p>
<p><span class="figure-number">Figure 52: </span>Upper bounds on the super sensor&rsquo;s noise and super sensor&rsquo;s uncertainty (<a href="./figs/charac_sensors_weights.png">png</a>, <a href="./figs/charac_sensors_weights.pdf">pdf</a>)</p>
</div>
<p>
The corresponding maximum norms of the filters to have the perf/robust asked are shown in Fig. <a href="#orgf077570">53</a>.
</p>
<div id="orgf077570" class="figure">
<p><img src="figs/upper_bound_complementary_filters_perf_robust.png" alt="upper_bound_complementary_filters_perf_robust.png" />
</p>
<p><span class="figure-number">Figure 53: </span>Upper bounds on the complementary filters (<a href="./figs/upper_bound_complementary_filters_perf_robust.png">png</a>, <a href="./figs/upper_bound_complementary_filters_perf_robust.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org24c30da" class="outline-3">
<h3 id="org24c30da"><span class="section-number-3">6.4</span> H-infinity synthesis with 4 outputs corresponding to the 4 weights</h3>
<div class="outline-text-3" id="text-6-4">
<p>
We do the \(\mathcal{H}_\infty\) synthesis with 4 weights and 4 outputs.
</p>
\begin{equation*}
\left\| \begin{matrix}
W_{1p}(s) (1 - N_2(s)) \\
W_{2p}(s) N_2(s) \\
W_{1u}(s) (1 - N_2(s)) \\
W_{2u}(s) N_2(s)
\end{matrix} \right\|_\infty < 1
\end{equation*}
<div class="org-src-container">
<pre class="src src-matlab">W1p = N1*Wp/(1+s/2/pi/1000); % Used to render W1p proper
W2p = N2*Wp;
W1u = w1*Wu;
W2u = w2*Wu;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">P = [W1p -W1p;
0 W2p;
W1u -W1u;
0 W2u;
1 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_\infty\) synthesis using the <code>hinfsyn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
</pre>
</div>
<pre class="example">
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
Resetting value of Gamma min based on D_11, D_12, D_21 terms
Test bounds: 1.4139 &lt; gamma &lt;= 65.6899
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
65.690 1.3e+00 -6.7e-15 1.3e+00 -4.5e-13 0.0000 p
33.552 1.3e+00 -9.4e-15 1.3e+00 -3.7e-14 0.0000 p
17.483 1.3e+00 -5.6e-16 1.3e+00 -4.8e-13 0.0000 p
9.448 1.3e+00 -3.2e-15 1.3e+00 -1.2e-13 0.0000 p
5.431 1.3e+00 -2.3e-16 1.3e+00 -3.6e-13 0.0000 p
3.422 1.3e+00 -7.3e-16 1.3e+00 -2.6e-15 0.0000 p
2.418 1.3e+00 9.3e-17 1.3e+00 -3.0e-14 0.0000 p
1.916 1.3e+00 2.4e-17 1.3e+00 -2.2e-14 0.0000 p
1.665 1.3e+00 -2.5e-16 1.3e+00 -2.1e-14 0.0000 p
1.539 1.3e+00 -6.9e-15 1.3e+00 -5.3e-14 0.0000 p
1.477 1.3e+00 -2.1e-14 1.3e+00 -2.3e-13 0.0000 p
1.445 1.3e+00 -1.3e-16 1.3e+00 -2.6e-15 0.0000 p
1.430 1.3e+00 -4.9e-13 1.3e+00 -2.2e-13 0.0000 p
1.422 1.3e+00 -1.2e+08# 1.3e+00 -2.6e-13 0.0000 f
1.426 1.3e+00 -6.3e-13 1.3e+00 -3.3e-14 0.0000 p
1.424 1.3e+00 -3.4e+08# 1.3e+00 -4.5e-14 0.0000 f
1.425 1.3e+00 -1.7e+09# 1.3e+00 -5.2e-13 0.0000 f
Gamma value achieved: 1.4256
</pre>
<div class="org-src-container">
<pre class="src src-matlab">H1 = 1 - H2;
</pre>
</div>
<p>
The obtained complementary filters with the upper bounds are shown in Fig. <a href="#orgbcfcb41">54</a>.
</p>
<div id="orgbcfcb41" class="figure">
<p><img src="figs/hinf_result_comp_filters_4_outputs.png" alt="hinf_result_comp_filters_4_outputs.png" />
</p>
<p><span class="figure-number">Figure 54: </span>caption (<a href="./figs/hinf_result_comp_filters_4_outputs.png">png</a>, <a href="./figs/hinf_result_comp_filters_4_outputs.pdf">pdf</a>)</p>
</div>
<div id="org3342a6f" class="figure">
<p><img src="figs/upper_bounds_perf_robust_result_4_outputs.png" alt="upper_bounds_perf_robust_result_4_outputs.png" />
</p>
<p><span class="figure-number">Figure 55: </span>Obtained PSD and uncertainty with the corresponding upper bounds (<a href="./figs/upper_bounds_perf_robust_result_4_outputs.png">png</a>, <a href="./figs/upper_bounds_perf_robust_result_4_outputs.pdf">pdf</a>)</p>
</div>
<div id="org34b311b" class="figure">
<p><img src="figs/4outputs_hinf_psd_cps2svg.png" alt="4outputs_hinf_psd_cps2svg.png" />
</p>
<p><span class="figure-number">Figure 56: </span>PSD and CPS (<a href="./figs/4outputs_hinf_psd_cps2svg.png">png</a>, <a href="./figs/4outputs_hinf_psd_cps2svg.pdf">pdf</a>)</p>
</div>
<div id="org3395c44" class="figure">
<p><img src="figs/4outputs_uncertainty.png" alt="4outputs_uncertainty.png" />
</p>
<p><span class="figure-number">Figure 57: </span>Dynamical uncertainty (<a href="./figs/4outputs_uncertainty.png">png</a>, <a href="./figs/4outputs_uncertainty.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org0b9b366" class="outline-3">
<h3 id="org0b9b366"><span class="section-number-3">6.5</span> Conclusion</h3>
<div class="outline-text-3" id="text-6-5">
<p>
The \(\mathcal{H}_\infty\) synthesis has been used to design complementary filters that permits to robustly merge sensors while ensuring a maximum noise level.
However, no guarantee is made that the RMS value of the super sensor&rsquo;s noise is minimized.
</p>
</div>
</div>
</div>
<div id="outline-container-org234e3d5" class="outline-2">
<h2 id="org234e3d5"><span class="section-number-2">7</span> Equivalent Super Sensor</h2>
<div class="outline-text-2" id="text-7">
<p>
<a id="orgde63ba6"></a>
</p>
<p>
The goal here is to find the parameters of a single sensor that would best represent a super sensor.
</p>
</div>
<div id="outline-container-org830b01f" class="outline-3">
<h3 id="org830b01f"><span class="section-number-3">7.1</span> Sensor Fusion Architecture</h3>
<div class="outline-text-3" id="text-7-1">
<p>
Let consider figure <a href="#org956eee0">58</a> where two sensors are merged.
The dynamic uncertainty of each sensor is represented by a weight \(w_i(s)\), the frequency characteristics each of the sensor noise is represented by the weights \(N_i(s)\).
The noise sources \(\tilde{n}_i\) are considered to be white noise: \(\Phi_{\tilde{n}_i}(\omega) = 1, \ \forall\omega\).
</p>
<div id="org956eee0" class="figure">
<p><img src="figs-tikz/sensor_fusion_full.png" alt="sensor_fusion_full.png" />
</p>
<p><span class="figure-number">Figure 58: </span>Sensor fusion architecture (<a href="./figs/sensor_fusion_full.png">png</a>, <a href="./figs/sensor_fusion_full.pdf">pdf</a>).</p>
</div>
\begin{align*}
\hat{x} &= H_1(s) N_1(s) \tilde{n}_1 + H_2(s) N_2(s) \tilde{n}_2 \\
&\quad \quad + \Big(H_1(s) \big(1 + w_1(s) \Delta_1(s)\big) + H_2(s) \big(1 + w_2(s) \Delta_2(s)\big)\Big) x \\
&= H_1(s) N_1(s) \tilde{n}_1 + H_2(s) N_2(s) \tilde{n}_2 \\
&\quad \quad + \big(1 + H_1(s) w_1(s) \Delta_1(s) + H_2(s) w_2(s) \Delta_2(s)\big) x
\end{align*}
<p>
To the dynamics of the super sensor is:
</p>
\begin{equation}
\frac{\hat{x}}{x} = 1 + H_1(s) w_1(s) \Delta_1(s) + H_2(s) w_2(s) \Delta_2(s)
\end{equation}
<p>
And the noise of the super sensor is:
</p>
\begin{equation}
n_{ss} = H_1(s) N_1(s) \tilde{n}_1 + H_2(s) N_2(s) \tilde{n}_2
\end{equation}
</div>
</div>
<div id="outline-container-org19369bb" class="outline-3">
<h3 id="org19369bb"><span class="section-number-3">7.2</span> Equivalent Configuration</h3>
<div class="outline-text-3" id="text-7-2">
<p>
We try to determine \(w_{ss}(s)\) and \(N_{ss}(s)\) such that the sensor on figure <a href="#org5e99712">59</a> is equivalent to the super sensor of figure <a href="#org956eee0">58</a>.
</p>
<div id="org5e99712" class="figure">
<p><img src="figs-tikz/sensor_fusion_equivalent.png" alt="sensor_fusion_equivalent.png" />
</p>
<p><span class="figure-number">Figure 59: </span>Equivalent Super Sensor (<a href="./figs/sensor_fusion_equivalent.png">png</a>, <a href="./figs/sensor_fusion_equivalent.pdf">pdf</a>).</p>
</div>
</div>
</div>
<div id="outline-container-org0bcdc83" class="outline-3">
<h3 id="org0bcdc83"><span class="section-number-3">7.3</span> Model the uncertainty of the super sensor</h3>
<div class="outline-text-3" id="text-7-3">
<p>
At each frequency \(\omega\), the uncertainty set of the super sensor shown on figure <a href="#org956eee0">58</a> is a circle centered on \(1\) with a radius equal to \(|H_1(j\omega) w_1(j\omega)| + |H_2(j\omega) w_2(j\omega)|\) on the complex plane.
The uncertainty set of the sensor shown on figure <a href="#org5e99712">59</a> is a circle centered on \(1\) with a radius equal to \(|w_{ss}(j\omega)|\) on the complex plane.
</p>
<p>
Ideally, we want to find a weight \(w_{ss}(s)\) so that:
</p>
<div class="important">
<p>
\[ |w_{ss}(j\omega)| = |H_1(j\omega) w_1(j\omega)| + |H_2(j\omega) w_2(j\omega)|, \quad \forall\omega \]
</p>
</div>
</div>
</div>
<div id="outline-container-org9dcaa89" class="outline-3">
<h3 id="org9dcaa89"><span class="section-number-3">7.4</span> Model the noise of the super sensor</h3>
<div class="outline-text-3" id="text-7-4">
<p>
The PSD of the estimation \(\hat{x}\) when \(x = 0\) of the configuration shown on figure <a href="#org956eee0">58</a> is:
</p>
\begin{align*}
\Phi_{\hat{x}}(\omega) &= | H_1(j\omega) N_1(j\omega) |^2 \Phi_{\tilde{n}_1} + | H_2(j\omega) N_2(j\omega) |^2 \Phi_{\tilde{n}_2} \\
&= | H_1(j\omega) N_1(j\omega) |^2 + | H_2(j\omega) N_2(j\omega) |^2
\end{align*}
<p>
The PSD of the estimation \(\hat{x}\) when \(x = 0\) of the configuration shown on figure <a href="#org5e99712">59</a> is:
</p>
\begin{align*}
\Phi_{\hat{x}}(\omega) &= | N_{ss}(j\omega) |^2 \Phi_{\tilde{n}} \\
&= | N_{ss}(j\omega) |^2
\end{align*}
<p>
Ideally, we want to find a weight \(N_{ss}(s)\) such that:
</p>
<div class="important">
<p>
\[ |N_{ss}(j\omega)|^2 = | H_1(j\omega) N_1(j\omega) |^2 + | H_2(j\omega) N_2(j\omega) |^2 \quad \forall\omega \]
</p>
</div>
</div>
</div>
<div id="outline-container-orge794bc8" class="outline-3">
<h3 id="orge794bc8"><span class="section-number-3">7.5</span> First guess</h3>
<div class="outline-text-3" id="text-7-5">
<p>
We could choose
</p>
\begin{align*}
w_{ss}(s) &= H_1(s) w_1(s) + H_2(s) w_2(s) \\
N_{ss}(s) &= H_1(s) N_1(s) + H_2(s) N_2(s)
\end{align*}
<p>
But we would have:
</p>
\begin{align*}
|w_{ss}(j\omega)| &= |H_1(j\omega) w_1(j\omega) + H_2(j\omega) w_2(j\omega)|, \quad \forall\omega \\
&\neq |H_1(j\omega) w_1(j\omega)| + |H_2(j\omega) w_2(j\omega)|, \quad \forall\omega
\end{align*}
<p>
and
</p>
\begin{align*}
|N_{ss}(j\omega)|^2 &= | H_1(j\omega) N_1(j\omega) + H_2(j\omega) N_2(j\omega) |^2 \quad \forall\omega \\
&\neq | H_1(j\omega) N_1(j\omega)|^2 + |H_2(j\omega) N_2(j\omega) |^2 \quad \forall\omega \\
\end{align*}
</div>
</div>
</div>
<div id="outline-container-orgb29a257" class="outline-2">
<h2 id="orgb29a257"><span class="section-number-2">8</span> Optimal And Robust Sensor Fusion in Practice</h2>
<div class="outline-text-2" id="text-8">
<p>
<a id="orgd4ca2cf"></a>
</p>
<p>
Here are the steps in order to apply optimal and robust sensor fusion:
</p>
<ul class="org-ul">
<li>Measure the noise characteristics of the sensors to be merged (necessary for &ldquo;optimal&rdquo; part of the fusion)</li>
<li>Measure/Estimate the dynamic uncertainty of the sensors (necessary for &ldquo;robust&rdquo; part of the fusion)</li>
<li>Apply H2/H-infinity synthesis of the complementary filters</li>
</ul>
</div>
<div id="outline-container-orga412cf7" class="outline-3">
<h3 id="orga412cf7"><span class="section-number-3">8.1</span> Measurement of the noise characteristics of the sensors</h3>
<div class="outline-text-3" id="text-8-1">
</div>
<div id="outline-container-orgce95926" class="outline-4">
<h4 id="orgce95926"><span class="section-number-4">8.1.1</span> Huddle Test</h4>
<div class="outline-text-4" id="text-8-1-1">
<p>
The technique to estimate the sensor noise is taken from (<a href="#citeproc_bib_item_2">Barzilai, VanZandt, and Kenny 1998</a>).
</p>
<p>
Let&rsquo;s consider two sensors (sensor 1 and sensor 2) that are measuring the same quantity \(x\) as shown in figure <a href="#org29b3d27">60</a>.
</p>
<div id="org29b3d27" class="figure">
<p><img src="figs-tikz/huddle_test.png" alt="huddle_test.png" />
</p>
<p><span class="figure-number">Figure 60: </span>Huddle test block diagram</p>
</div>
<p>
Each sensor has uncorrelated noise \(n_1\) and \(n_2\) and internal dynamics \(G_1(s)\) and \(G_2(s)\) respectively.
</p>
<p>
We here suppose that each sensor has the same magnitude of instrumental noise: \(n_1 = n_2 = n\).
We also assume that their dynamics is ideal: \(G_1(s) = G_2(s) = 1\).
</p>
<p>
We then have:
</p>
\begin{equation}
\label{orgdad26a1}
\gamma_{\hat{x}_1\hat{x}_2}^2(\omega) = \frac{1}{1 + 2 \left( \frac{|\Phi_n(\omega)|}{|\Phi_{\hat{x}}(\omega)|} \right) + \left( \frac{|\Phi_n(\omega)|}{|\Phi_{\hat{x}}(\omega)|} \right)^2}
\end{equation}
<p>
Since the input signal \(x\) and the instrumental noise \(n\) are incoherent:
</p>
\begin{equation}
\label{org320aa52}
|\Phi_{\hat{x}}(\omega)| = |\Phi_n(\omega)| + |\Phi_x(\omega)|
\end{equation}
<p>
From equations \eqref{eq:coh_bis} and \eqref{eq:incoherent_noise}, we finally obtain
</p>
<div class="important">
\begin{equation}
\label{org57c4428}
|\Phi_n(\omega)| = |\Phi_{\hat{x}}(\omega)| \left( 1 - \sqrt{\gamma_{\hat{x}_1\hat{x}_2}^2(\omega)} \right)
\end{equation}
</div>
</div>
</div>
<div id="outline-container-org60d7173" class="outline-4">
<h4 id="org60d7173"><span class="section-number-4">8.1.2</span> Weights that represents the noises&rsquo; PSD</h4>
<div class="outline-text-4" id="text-8-1-2">
<p>
For further complementary filter synthesis, it is preferred to consider a normalized noise source \(\tilde{n}\) that has a PSD equal to one (\(\Phi_{\tilde{n}}(\omega) = 1\)) and to use a weighting filter \(N(s)\) in order to represent the frequency dependence of the noise.
</p>
<p>
The weighting filter \(N(s)\) should be designed such that:
</p>
\begin{align*}
& \Phi_n(\omega) \approx |N(j\omega)|^2 \Phi_{\tilde{n}}(\omega) \quad \forall \omega \\
\Longleftrightarrow & |N(j\omega)| \approx \sqrt{\Phi_n(\omega)} \quad \forall \omega
\end{align*}
<p>
These weighting filters can then be used to compare the noise level of sensors for the synthesis of complementary filters.
</p>
<p>
The sensor with a normalized noise input is shown in figure <a href="#org99a3b66">61</a>.
</p>
<div id="org99a3b66" class="figure">
<p><img src="figs-tikz/one_sensor_normalized_noise.png" alt="one_sensor_normalized_noise.png" />
</p>
<p><span class="figure-number">Figure 61: </span>One sensor with normalized noise</p>
</div>
</div>
</div>
<div id="outline-container-org8a4e4ca" class="outline-4">
<h4 id="org8a4e4ca"><span class="section-number-4">8.1.3</span> Comparison of the noises&rsquo; PSD</h4>
<div class="outline-text-4" id="text-8-1-3">
<p>
Once the noise of the sensors to be merged have been characterized, the power spectral density of both sensors have to be compared.
</p>
<p>
Ideally, the PSD of the noise are such that:
</p>
\begin{align*}
\Phi_{n_1}(\omega) &< \Phi_{n_2}(\omega) \text{ for } \omega < \omega_m \\
\Phi_{n_1}(\omega) &> \Phi_{n_2}(\omega) \text{ for } \omega > \omega_m
\end{align*}
</div>
</div>
<div id="outline-container-org185f2af" class="outline-4">
<h4 id="org185f2af"><span class="section-number-4">8.1.4</span> Computation of the coherence, power spectral density and cross spectral density of signals</h4>
<div class="outline-text-4" id="text-8-1-4">
<p>
The coherence between signals \(x\) and \(y\) is defined as follow
\[ \gamma^2_{xy}(\omega) = \frac{|\Phi_{xy}(\omega)|^2}{|\Phi_{x}(\omega)| |\Phi_{y}(\omega)|} \]
where \(|\Phi_x(\omega)|\) is the output Power Spectral Density (PSD) of signal \(x\) and \(|\Phi_{xy}(\omega)|\) is the Cross Spectral Density (CSD) of signal \(x\) and \(y\).
</p>
<p>
The PSD and CSD are defined as follow:
</p>
\begin{align}
|\Phi_x(\omega)| &= \frac{2}{n_d T} \sum^{n_d}_{n=1} \left| X_k(\omega, T) \right|^2 \\
|\Phi_{xy}(\omega)| &= \frac{2}{n_d T} \sum^{n_d}_{n=1} [ X_k^*(\omega, T) ] [ Y_k(\omega, T) ]
\end{align}
<p>
where:
</p>
<ul class="org-ul">
<li>\(n_d\) is the number for records averaged</li>
<li>\(T\) is the length of each record</li>
<li>\(X_k(\omega, T)\) is the finite Fourier transform of the \(k^{\text{th}}\) record</li>
<li>\(X_k^*(\omega, T)\) is its complex conjugate</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-org5894e0f" class="outline-3">
<h3 id="org5894e0f"><span class="section-number-3">8.2</span> Estimate the dynamic uncertainty of the sensors</h3>
<div class="outline-text-3" id="text-8-2">
<p>
Let&rsquo;s consider one sensor represented on figure <a href="#org6492759">62</a>.
</p>
<p>
The dynamic uncertainty is represented by an input multiplicative uncertainty where \(w(s)\) is a weight that represents the level of the uncertainty.
</p>
<p>
The goal is to accurately determine \(w(s)\) for the sensors that have to be merged.
</p>
<div id="org6492759" class="figure">
<p><img src="figs-tikz/one_sensor_dyn_uncertainty.png" alt="one_sensor_dyn_uncertainty.png" />
</p>
<p><span class="figure-number">Figure 62: </span>Sensor with dynamic uncertainty</p>
</div>
</div>
</div>
<div id="outline-container-org770784c" class="outline-3">
<h3 id="org770784c"><span class="section-number-3">8.3</span> Optimal and Robust synthesis of the complementary filters</h3>
<div class="outline-text-3" id="text-8-3">
<p>
Once the noise characteristics and dynamic uncertainty of both sensors have been determined and we have determined the following weighting functions:
</p>
<ul class="org-ul">
<li>\(w_1(s)\) and \(w_2(s)\) representing the dynamic uncertainty of both sensors</li>
<li>\(N_1(s)\) and \(N_2(s)\) representing the noise characteristics of both sensors</li>
</ul>
<p>
The goal is to design complementary filters \(H_1(s)\) and \(H_2(s)\) shown in figure <a href="#org956eee0">58</a> such that:
</p>
<ul class="org-ul">
<li>the uncertainty on the super sensor dynamics is minimized</li>
<li>the noise sources \(\tilde{n}_1\) and \(\tilde{n}_2\) has the lowest possible effect on the estimation \(\hat{x}\)</li>
</ul>
<div id="org679de38" class="figure">
<p><img src="figs-tikz/sensor_fusion_full.png" alt="sensor_fusion_full.png" />
</p>
<p><span class="figure-number">Figure 63: </span>Sensor fusion architecture with sensor dynamics uncertainty</p>
</div>
</div>
</div>
</div>
<div id="outline-container-org1da98cf" class="outline-2">
<h2 id="org1da98cf"><span class="section-number-2">9</span> Methods of complementary filter synthesis</h2>
<div class="outline-text-2" id="text-9">
<p>
<a id="org64a9222"></a>
</p>
</div>
<div id="outline-container-org84dfcf2" class="outline-3">
<h3 id="org84dfcf2"><span class="section-number-3">9.1</span> Complementary filters using analytical formula</h3>
<div class="outline-text-3" id="text-9-1">
<p>
<a id="org4537526"></a>
</p>
<div class="note">
<p>
All the files (data and Matlab scripts) are accessible <a href="data/comp_filters_analytical.zip">here</a>.
</p>
</div>
</div>
<div id="outline-container-org5e7f279" class="outline-4">
<h4 id="org5e7f279"><span class="section-number-4">9.1.1</span> Analytical 1st order complementary filters</h4>
<div class="outline-text-4" id="text-9-1-1">
<p>
First order complementary filters are defined with following equations:
</p>
\begin{align}
H_L(s) = \frac{1}{1 + \frac{s}{\omega_0}}\\
H_H(s) = \frac{\frac{s}{\omega_0}}{1 + \frac{s}{\omega_0}}
\end{align}
<p>
Their bode plot is shown figure <a href="#org4d2c578">64</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">w0 = 2*pi; % [rad/s]
Hh1 = (s/w0)/((s/w0)+1);
Hl1 = 1/((s/w0)+1);
</pre>
</div>
<div id="org4d2c578" class="figure">
<p><img src="figs/comp_filter_1st_order.png" alt="comp_filter_1st_order.png" />
</p>
<p><span class="figure-number">Figure 64: </span>Bode plot of first order complementary filter (<a href="./figs/comp_filter_1st_order.png">png</a>, <a href="./figs/comp_filter_1st_order.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org779fef3" class="outline-4">
<h4 id="org779fef3"><span class="section-number-4">9.1.2</span> Second Order Complementary Filters</h4>
<div class="outline-text-4" id="text-9-1-2">
<p>
We here use analytical formula for the complementary filters \(H_L\) and \(H_H\).
</p>
<p>
The first two formulas that are used to generate complementary filters are:
</p>
\begin{align*}
H_L(s) &= \frac{(1+\alpha) (\frac{s}{\omega_0})+1}{\left((\frac{s}{\omega_0})+1\right) \left((\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1\right)}\\
H_H(s) &= \frac{(\frac{s}{\omega_0})^2 \left((\frac{s}{\omega_0})+1+\alpha\right)}{\left((\frac{s}{\omega_0})+1\right) \left((\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1\right)}
\end{align*}
<p>
where:
</p>
<ul class="org-ul">
<li>\(\omega_0\) is the blending frequency in rad/s.</li>
<li>\(\alpha\) is used to change the shape of the filters:
<ul class="org-ul">
<li>Small values for \(\alpha\) will produce high magnitude of the filters \(|H_L(j\omega)|\) and \(|H_H(j\omega)|\) near \(\omega_0\) but smaller value for \(|H_L(j\omega)|\) above \(\approx 1.5 \omega_0\) and for \(|H_H(j\omega)|\) below \(\approx 0.7 \omega_0\)</li>
<li>A large \(\alpha\) will do the opposite</li>
</ul></li>
</ul>
<p>
This is illustrated on figure <a href="#orgc425959">65</a>.
The slope of those filters at high and low frequencies is \(-2\) and \(2\) respectively for \(H_L\) and \(H_H\).
</p>
<div id="orgc425959" class="figure">
<p><img src="figs/comp_filters_param_alpha.png" alt="comp_filters_param_alpha.png" />
</p>
<p><span class="figure-number">Figure 65: </span>Effect of the parameter \(\alpha\) on the shape of the generated second order complementary filters (<a href="./figs/comp_filters_param_alpha.png">png</a>, <a href="./figs/comp_filters_param_alpha.pdf">pdf</a>)</p>
</div>
<p>
We now study the maximum norm of the filters function of the parameter \(\alpha\). As we saw that the maximum norm of the filters is important for the robust merging of filters.
</p>
<div class="org-src-container">
<pre class="src src-matlab">figure;
plot(alphas, infnorms)
set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
xlabel('$\alpha$'); ylabel('$\|H_1\|_\infty$');
</pre>
</div>
<div id="orgbfad683" class="figure">
<p><img src="figs/param_alpha_hinf_norm.png" alt="param_alpha_hinf_norm.png" />
</p>
<p><span class="figure-number">Figure 66: </span>Evolution of the H-Infinity norm of the complementary filters with the parameter \(\alpha\) (<a href="./figs/param_alpha_hinf_norm.png">png</a>, <a href="./figs/param_alpha_hinf_norm.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org4d7734e" class="outline-4">
<h4 id="org4d7734e"><span class="section-number-4">9.1.3</span> Third Order Complementary Filters</h4>
<div class="outline-text-4" id="text-9-1-3">
<p>
The following formula gives complementary filters with slopes of \(-3\) and \(3\):
</p>
\begin{align*}
H_L(s) &= \frac{\left(1+(\alpha+1)(\beta+1)\right) (\frac{s}{\omega_0})^2 + (1+\alpha+\beta)(\frac{s}{\omega_0}) + 1}{\left(\frac{s}{\omega_0} + 1\right) \left( (\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1 \right) \left( (\frac{s}{\omega_0})^2 + \beta (\frac{s}{\omega_0}) + 1 \right)}\\
H_H(s) &= \frac{(\frac{s}{\omega_0})^3 \left( (\frac{s}{\omega_0})^2 + (1+\alpha+\beta) (\frac{s}{\omega_0}) + (1+(\alpha+1)(\beta+1)) \right)}{\left(\frac{s}{\omega_0} + 1\right) \left( (\frac{s}{\omega_0})^2 + \alpha (\frac{s}{\omega_0}) + 1 \right) \left( (\frac{s}{\omega_0})^2 + \beta (\frac{s}{\omega_0}) + 1 \right)}
\end{align*}
<p>
The parameters are:
</p>
<ul class="org-ul">
<li>\(\omega_0\) is the blending frequency in rad/s</li>
<li>\(\alpha\) and \(\beta\) that are used to change the shape of the filters similarly to the parameter \(\alpha\) for the second order complementary filters</li>
</ul>
<p>
The filters are defined below and the result is shown on figure <a href="#org4a30e40">67</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">alpha = 1;
beta = 10;
w0 = 2*pi*14;
Hh3_ana = (s/w0)^3 * ((s/w0)^2 + (1+alpha+beta)*(s/w0) + (1+(alpha+1)*(beta+1)))/((s/w0 + 1)*((s/w0)^2+alpha*(s/w0)+1)*((s/w0)^2+beta*(s/w0)+1));
Hl3_ana = ((1+(alpha+1)*(beta+1))*(s/w0)^2 + (1+alpha+beta)*(s/w0) + 1)/((s/w0 + 1)*((s/w0)^2+alpha*(s/w0)+1)*((s/w0)^2+beta*(s/w0)+1));
</pre>
</div>
<div id="org4a30e40" class="figure">
<p><img src="figs/complementary_filters_third_order.png" alt="complementary_filters_third_order.png" />
</p>
<p><span class="figure-number">Figure 67: </span>Third order complementary filters using the analytical formula (<a href="./figs/complementary_filters_third_order.png">png</a>, <a href="./figs/complementary_filters_third_order.pdf">pdf</a>)</p>
</div>
</div>
</div>
</div>
<div id="outline-container-orgdf0d46f" class="outline-3">
<h3 id="orgdf0d46f"><span class="section-number-3">9.2</span> H-Infinity synthesis of complementary filters</h3>
<div class="outline-text-3" id="text-9-2">
<p>
<a id="orgdec21e0"></a>
</p>
<div class="note">
<p>
All the files (data and Matlab scripts) are accessible <a href="data/h_inf_synthesis_complementary_filters.zip">here</a>.
</p>
</div>
</div>
<div id="outline-container-org1c357b3" class="outline-4">
<h4 id="org1c357b3"><span class="section-number-4">9.2.1</span> Synthesis Architecture</h4>
<div class="outline-text-4" id="text-9-2-1">
<p>
We here synthesize the complementary filters using the \(\mathcal{H}_\infty\) synthesis.
The goal is to specify upper bounds on the norms of \(H_L\) and \(H_H\) while ensuring their complementary property (\(H_L + H_H = 1\)).
</p>
<p>
In order to do so, we use the generalized plant shown on figure <a href="#org776c12b">68</a> where \(w_L\) and \(w_H\) weighting transfer functions that will be used to shape \(H_L\) and \(H_H\) respectively.
</p>
<div id="org776c12b" class="figure">
<p><img src="figs-tikz/sf_hinf_filters_plant_b.png" alt="sf_hinf_filters_plant_b.png" />
</p>
<p><span class="figure-number">Figure 68: </span>Generalized plant used for the \(\mathcal{H}_\infty\) synthesis of the complementary filters</p>
</div>
<p>
The \(\mathcal{H}_\infty\) synthesis applied on this generalized plant will give a transfer function \(H_L\) (figure <a href="#orgd74e631">69</a>) such that the \(\mathcal{H}_\infty\) norm of the transfer function from \(w\) to \([z_H,\ z_L]\) is less than one:
\[ \left\| \begin{array}{c} H_L w_L \\ (1 - H_L) w_H \end{array} \right\|_\infty < 1 \]
</p>
<p>
Thus, if the above condition is verified, we can define \(H_H = 1 - H_L\) and we have that:
\[ \left\| \begin{array}{c} H_L w_L \\ H_H w_H \end{array} \right\|_\infty < 1 \]
Which is almost (with an maximum error of \(\sqrt{2}\)) equivalent to:
</p>
\begin{align*}
|H_L| &< \frac{1}{|w_L|}, \quad \forall \omega \\
|H_H| &< \frac{1}{|w_H|}, \quad \forall \omega
\end{align*}
<p>
We then see that \(w_L\) and \(w_H\) can be used to shape both \(H_L\) and \(H_H\) while ensuring (by definition of \(H_H = 1 - H_L\)) their complementary property.
</p>
<div id="orgd74e631" class="figure">
<p><img src="figs-tikz/sf_hinf_filters_b.png" alt="sf_hinf_filters_b.png" />
</p>
<p><span class="figure-number">Figure 69: </span>\(\mathcal{H}_\infty\) synthesis of the complementary filters</p>
</div>
</div>
</div>
<div id="outline-container-orgaff5449" class="outline-4">
<h4 id="orgaff5449"><span class="section-number-4">9.2.2</span> Weights</h4>
<div class="outline-text-4" id="text-9-2-2">
<div class="org-src-container">
<pre class="src src-matlab">omegab = 2*pi*9;
wH = (omegab)^2/(s + omegab*sqrt(1e-5))^2;
omegab = 2*pi*28;
wL = (s + omegab/(4.5)^(1/3))^3/(s*(1e-4)^(1/3) + omegab)^3;
</pre>
</div>
<div id="org2306fd6" class="figure">
<p><img src="figs/weights_wl_wh.png" alt="weights_wl_wh.png" />
</p>
<p><span class="figure-number">Figure 70: </span>Weights on the complementary filters \(w_L\) and \(w_H\) and the associated performance weights (<a href="./figs/weights_wl_wh.png">png</a>, <a href="./figs/weights_wl_wh.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org6938d30" class="outline-4">
<h4 id="org6938d30"><span class="section-number-4">9.2.3</span> H-Infinity Synthesis</h4>
<div class="outline-text-4" id="text-9-2-3">
<p>
We define the generalized plant \(P\) on matlab.
</p>
<div class="org-src-container">
<pre class="src src-matlab">P = [0 wL;
wH -wH;
1 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_\infty\) synthesis using the <code>hinfsyn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[Hl_hinf, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
</pre>
</div>
<pre class="example">
[Hl_hinf, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
Test bounds: 0.0000 &lt; gamma &lt;= 1.7285
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
1.729 4.1e+01 8.4e-12 1.8e-01 0.0e+00 0.0000 p
0.864 3.9e+01 -5.8e-02# 1.8e-01 0.0e+00 0.0000 f
1.296 4.0e+01 8.4e-12 1.8e-01 0.0e+00 0.0000 p
1.080 4.0e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p
0.972 3.9e+01 -4.2e-01# 1.8e-01 0.0e+00 0.0000 f
1.026 4.0e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p
0.999 3.9e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p
0.986 3.9e+01 -1.2e+00# 1.8e-01 0.0e+00 0.0000 f
0.993 3.9e+01 -8.2e+00# 1.8e-01 0.0e+00 0.0000 f
0.996 3.9e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p
0.994 3.9e+01 8.5e-12 1.8e-01 0.0e+00 0.0000 p
0.993 3.9e+01 -3.2e+01# 1.8e-01 0.0e+00 0.0000 f
Gamma value achieved: 0.9942
</pre>
<p>
We then define the high pass filter \(H_H = 1 - H_L\). The bode plot of both \(H_L\) and \(H_H\) is shown on figure <a href="#org916a0b7">71</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Hh_hinf = 1 - Hl_hinf;
</pre>
</div>
</div>
</div>
<div id="outline-container-org890772f" class="outline-4">
<h4 id="org890772f"><span class="section-number-4">9.2.4</span> Obtained Complementary Filters</h4>
<div class="outline-text-4" id="text-9-2-4">
<p>
The obtained complementary filters are shown on figure <a href="#org916a0b7">71</a>.
</p>
<div id="org916a0b7" class="figure">
<p><img src="figs/hinf_filters_results.png" alt="hinf_filters_results.png" />
</p>
<p><span class="figure-number">Figure 71: </span>Obtained complementary filters using \(\mathcal{H}_\infty\) synthesis (<a href="./figs/hinf_filters_results.png">png</a>, <a href="./figs/hinf_filters_results.pdf">pdf</a>)</p>
</div>
</div>
</div>
</div>
<div id="outline-container-orgeac5c0a" class="outline-3">
<h3 id="orgeac5c0a"><span class="section-number-3">9.3</span> Feedback Control Architecture to generate Complementary Filters</h3>
<div class="outline-text-3" id="text-9-3">
<p>
<a id="orgf582b7b"></a>
</p>
<p>
The idea is here to use the fact that in a classical feedback architecture, \(S + T = 1\), in order to design complementary filters.
</p>
<p>
Thus, all the tools that has been developed for classical feedback control can be used for complementary filter design.
</p>
<div class="note">
<p>
All the files (data and Matlab scripts) are accessible <a href="data/feedback_generate_comp_filters.zip">here</a>.
</p>
</div>
</div>
<div id="outline-container-orgfb21c1d" class="outline-4">
<h4 id="orgfb21c1d"><span class="section-number-4">9.3.1</span> Architecture</h4>
<div class="outline-text-4" id="text-9-3-1">
<div id="orgc2333c8" class="figure">
<p><img src="figs-tikz/complementary_filters_feedback_architecture.png" alt="complementary_filters_feedback_architecture.png" />
</p>
<p><span class="figure-number">Figure 72: </span>Architecture used to generate the complementary filters</p>
</div>
<p>
We have:
\[ y = \underbrace{\frac{L}{L + 1}}_{H_L} y_1 + \underbrace{\frac{1}{L + 1}}_{H_H} y_2 \]
with \(H_L + H_H = 1\).
</p>
<p>
The only thing to design is \(L\) such that the complementary filters are stable with the wanted shape.
</p>
<p>
A simple choice is:
\[ L = \left(\frac{\omega_c}{s}\right)^2 \frac{\frac{s}{\omega_c / \alpha} + 1}{\frac{s}{\omega_c} + \alpha} \]
</p>
<p>
Which contains two integrator and a lead. \(\omega_c\) is used to tune the crossover frequency and \(\alpha\) the trade-off &ldquo;bump&rdquo; around blending frequency and filtering away from blending frequency.
</p>
</div>
</div>
<div id="outline-container-orgd0b6480" class="outline-4">
<h4 id="orgd0b6480"><span class="section-number-4">9.3.2</span> Loop Gain Design</h4>
<div class="outline-text-4" id="text-9-3-2">
<p>
Let&rsquo;s first define the loop gain \(L\).
</p>
<div class="org-src-container">
<pre class="src src-matlab">wc = 2*pi*1;
alpha = 2;
L = (wc/s)^2 * (s/(wc/alpha) + 1)/(s/wc + alpha);
</pre>
</div>
<div id="org70c07fe" class="figure">
<p><img src="figs/loop_gain_bode_plot.png" alt="loop_gain_bode_plot.png" />
</p>
<p><span class="figure-number">Figure 73: </span>Bode plot of the loop gain \(L\) (<a href="./figs/loop_gain_bode_plot.png">png</a>, <a href="./figs/loop_gain_bode_plot.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-orga4c7aef" class="outline-4">
<h4 id="orga4c7aef"><span class="section-number-4">9.3.3</span> Complementary Filters Obtained</h4>
<div class="outline-text-4" id="text-9-3-3">
<p>
We then compute the resulting low pass and high pass filters.
</p>
<div class="org-src-container">
<pre class="src src-matlab">Hl = L/(L + 1);
Hh = 1/(L + 1);
</pre>
</div>
<div id="orgfb2dd6a" class="figure">
<p><img src="figs/low_pass_high_pass_filters.png" alt="low_pass_high_pass_filters.png" />
</p>
<p><span class="figure-number">Figure 74: </span>Low pass and High pass filters \(H_L\) and \(H_H\) for different values of \(\alpha\) (<a href="./figs/low_pass_high_pass_filters.png">png</a>, <a href="./figs/low_pass_high_pass_filters.pdf">pdf</a>)</p>
</div>
</div>
</div>
</div>
<div id="outline-container-org1fdacfa" class="outline-3">
<h3 id="org1fdacfa"><span class="section-number-3">9.4</span> Analytical Formula found in the literature</h3>
<div class="outline-text-3" id="text-9-4">
<p>
<a id="org8831d28"></a>
</p>
</div>
<div id="outline-container-org9dc41c5" class="outline-4">
<h4 id="org9dc41c5"><span class="section-number-4">9.4.1</span> Analytical Formula</h4>
<div class="outline-text-4" id="text-9-4-1">
<p>
(<a href="#citeproc_bib_item_6">Min and Jeung 2015</a>)
</p>
\begin{align*}
H_L(s) = \frac{K_p s + K_i}{s^2 + K_p s + K_i} \\
H_H(s) = \frac{s^2}{s^2 + K_p s + K_i}
\end{align*}
<p>
(<a href="#citeproc_bib_item_4">Corke 2004</a>)
</p>
\begin{align*}
H_L(s) = \frac{1}{s/p + 1} \\
H_H(s) = \frac{s/p}{s/p + 1}
\end{align*}
<p>
(<a href="#citeproc_bib_item_5">Jensen, Coopmans, and Chen 2013</a>)
</p>
\begin{align*}
H_L(s) = \frac{2 \omega_0 s + \omega_0^2}{(s + \omega_0)^2} \\
H_H(s) = \frac{s^2}{(s + \omega_0)^2}
\end{align*}
\begin{align*}
H_L(s) = \frac{C(s)}{C(s) + s} \\
H_H(s) = \frac{s}{C(s) + s}
\end{align*}
<p>
(<a href="#citeproc_bib_item_10">Shaw and Srinivasan 1990</a>)
</p>
\begin{align*}
H_L(s) = \frac{3 \tau s + 1}{(\tau s + 1)^3} \\
H_H(s) = \frac{\tau^3 s^3 + 3 \tau^2 s^2}{(\tau s + 1)^3}
\end{align*}
<p>
(<a href="#citeproc_bib_item_1">Baerveldt and Klang 1997</a>)
</p>
\begin{align*}
H_L(s) = \frac{2 \tau s + 1}{(\tau s + 1)^2} \\
H_H(s) = \frac{\tau^2 s^2}{(\tau s + 1)^2}
\end{align*}
</div>
</div>
<div id="outline-container-org08a60d2" class="outline-4">
<h4 id="org08a60d2"><span class="section-number-4">9.4.2</span> Matlab</h4>
<div class="outline-text-4" id="text-9-4-2">
<div class="org-src-container">
<pre class="src src-matlab">omega0 = 1*2*pi; % [rad/s]
tau = 1/omega0; % [s]
% From cite:corke04_inert_visual_sensin_system_small_auton_helic
HL1 = 1/(s/omega0 + 1); HH1 = s/omega0/(s/omega0 + 1);
% From cite:jensen13_basic_uas
HL2 = (2*omega0*s + omega0^2)/(s+omega0)^2; HH2 = s^2/(s+omega0)^2;
% From cite:shaw90_bandw_enhan_posit_measur_using_measur_accel
HL3 = (3*tau*s + 1)/(tau*s + 1)^3; HH3 = (tau^3*s^3 + 3*tau^2*s^2)/(tau*s + 1)^3;
</pre>
</div>
<div id="orgd0293ed" class="figure">
<p><img src="figs/comp_filters_literature.png" alt="comp_filters_literature.png" />
</p>
<p><span class="figure-number">Figure 75: </span>Comparison of some complementary filters found in the literature (<a href="./figs/comp_filters_literature.png">png</a>, <a href="./figs/comp_filters_literature.pdf">pdf</a>)</p>
</div>
</div>
</div>
<div id="outline-container-org987779d" class="outline-4">
<h4 id="org987779d"><span class="section-number-4">9.4.3</span> Discussion</h4>
<div class="outline-text-4" id="text-9-4-3">
<p>
Analytical Formula found in the literature provides either no parameter for tuning the robustness / performance trade-off.
</p>
</div>
</div>
</div>
<div id="outline-container-orge65c21c" class="outline-3">
<h3 id="orge65c21c"><span class="section-number-3">9.5</span> Comparison of the different methods of synthesis</h3>
<div class="outline-text-3" id="text-9-5">
<p>
<a id="org8b0d8ac"></a>
The generated complementary filters using \(\mathcal{H}_\infty\) and the analytical formulas are very close to each other. However there is some difference to note here:
</p>
<ul class="org-ul">
<li>the analytical formula provides a very simple way to generate the complementary filters (and thus the controller), they could even be used to tune the controller online using the parameters \(\alpha\) and \(\omega_0\). However, these formula have the property that \(|H_H|\) and \(|H_L|\) are symmetrical with the frequency \(\omega_0\) which may not be desirable.</li>
<li>while the \(\mathcal{H}_\infty\) synthesis of the complementary filters is not as straightforward as using the analytical formula, it provides a more optimized procedure to obtain the complementary filters</li>
</ul>
</div>
</div>
</div>
<div id="outline-container-org8912234" class="outline-2">
<h2 id="org8912234"><span class="section-number-2">10</span> Real World Example of optimal sensor fusion</h2>
<div class="outline-text-2" id="text-10">
<p>
(<a href="#citeproc_bib_item_7">Moore, Fleming, and Yong 2019</a>)
</p>
</div>
<div id="outline-container-orge687802" class="outline-3">
<h3 id="orge687802"><span class="section-number-3">10.1</span> Matlab Code</h3>
<div class="outline-text-3" id="text-10-1">
<p>
Take an Accelerometer and a Geophone both measuring the absolute motion of a structure.
</p>
<p>
Parameters of the inertial sensors.
</p>
<div class="org-src-container">
<pre class="src src-matlab">m_acc = 0.01;
k_acc = 1e6;
c_acc = 20;
m_geo = 1;
k_geo = 1e3;
c_geo = 10;
</pre>
</div>
<p>
Transfer function from motion to measurement
</p>
<p>
For the accelerometer.
The measurement is the relative motion structure/inertial mass:
\[ \frac{d}{\ddot{w}} = \frac{-m}{ms^2 + cs + k} \]
</p>
<p>
For the geophone.
The measurement is the relative velocity structure/inertial mass:
\[ \frac{\dot{d}}{\dot{w}} = \frac{-ms^2}{ms^2 + cs + k} \]
</p>
<div class="org-src-container">
<pre class="src src-matlab">G_acc = -m_acc/(m_acc*s^2 + c_acc*s + k_acc); % [m/(m/s^2)]
G_geo = -m_geo*s^2/(m_geo*s^2 + c_geo*s + k_geo); % [m/s/m/s]
</pre>
</div>
<p>
Suppose the measure of the relative motion for the accelerometer (capacitive sensor for instance) has a white noise characteristic:
Suppose the measure of the relative velocity (current flowing through the coil) has a white noise characteristic:
</p>
<p>
Define the noise characteristics
</p>
<div class="org-src-container">
<pre class="src src-matlab">n = 1; w0 = 2*pi*5e3; G0 = 5e-12; G1 = 1e-15; Gc = G0/2;
L_acc = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
n = 1; w0 = 2*pi*5e3; G0 = 1e-6; G1 = 1e-8; Gc = G0/2;
L_geo = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G1)^(1/n)*(1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (1/Gc)^(1/n)))^n;
</pre>
</div>
<p>
Transfer function of the conversion to obtain the velocity:
</p>
<div class="org-src-container">
<pre class="src src-matlab">C_acc = (-k_acc/m_acc/(2*pi + s));
C_geo = tf(-1);
</pre>
</div>
<p>
Let&rsquo;s plot the noise of both sensors:
Dynamics of both sensors
</p>
</div>
</div>
<div id="outline-container-org617a4c7" class="outline-3">
<h3 id="org617a4c7"><span class="section-number-3">10.2</span> Time domain signals</h3>
<div class="outline-text-3" id="text-10-2">
<div class="org-src-container">
<pre class="src src-matlab">Fs = 1e4; % Sampling Frequency [Hz]
Ts = 1/Fs; % Sampling Time [s]
t = 0:Ts:10; % Time Vector [s]
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">n_acc = lsim(L_acc*C_acc, sqrt(Fs/2)*randn(length(t), 1), t); % [m/s]
n_geo = lsim(L_geo*C_geo, sqrt(Fs/2)*randn(length(t), 1), t); % [m/s]
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(t, n_geo)
plot(t, n_acc)
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-org127a184" class="outline-3">
<h3 id="org127a184"><span class="section-number-3">10.3</span> H2 Synthesis</h3>
<div class="outline-text-3" id="text-10-3">
<div class="org-src-container">
<pre class="src src-matlab">N1 = L_acc*C_acc;
N2 = L_geo*C_geo;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">bodeFig({N1, N2}, logspace(-1, 5, 1000))
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">P = [0 N2 1;
N1 -N2 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_2\) synthesis using the <code>h2syn</code> command.
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H1, ~, gamma] = h2syn(P, 1, 1);
</pre>
</div>
<p>
Finally, we define \(H_2(s) = 1 - H_1(s)\).
</p>
<div class="org-src-container">
<pre class="src src-matlab">H2 = 1 - H1;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">bodeFig({H1, H2}, struct('phase', true))
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">n_acc_filt = lsim(H1, n_acc, t);
n_geo_filt = lsim(H2, n_geo, t);
</pre>
</div>
<table border="2" cellspacing="0" cellpadding="6" rules="groups" frame="hsides">
<colgroup>
<col class="org-left" />
<col class="org-right" />
</colgroup>
<thead>
<tr>
<th scope="col" class="org-left">&#xa0;</th>
<th scope="col" class="org-right">RMS</th>
</tr>
</thead>
<tbody>
<tr>
<td class="org-left">Accelerometer</td>
<td class="org-right">9.7e-05</td>
</tr>
<tr>
<td class="org-left">Geophone</td>
<td class="org-right">5.9e-05</td>
</tr>
<tr>
<td class="org-left">Super Sensor</td>
<td class="org-right">1.5e-05</td>
</tr>
</tbody>
</table>
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(t, n_geo)
plot(t, n_acc)
plot(t, n_acc_filt + n_geo_filt)
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-org164d058" class="outline-3">
<h3 id="org164d058"><span class="section-number-3">10.4</span> Signal and Noise</h3>
<div class="outline-text-3" id="text-10-4">
<p>
Velocity Signal:
</p>
<div class="org-src-container">
<pre class="src src-matlab">v = lsim(1/(1 + s/2/pi/2), 1e-4*sqrt(Fs/2)*randn(length(t), 1), t);
v = 1e-4 * sin(2*pi*100*t);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">v_acc = lsim(s*G_acc*C_acc, v, t) + n_acc;
v_geo = lsim(G_geo*C_geo, v, t) + n_geo;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">v_ss = lsim(H1, v_acc, t) + lsim(H2, v_geo, t);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(t, v_geo)
plot(t, v_acc)
plot(t, v_ss)
plot(t, v, 'k--')
hold off;
xlim([1, 1+0.1])
</pre>
</div>
</div>
</div>
<div id="outline-container-orgec23fa5" class="outline-3">
<h3 id="orgec23fa5"><span class="section-number-3">10.5</span> PSD and CPS</h3>
<div class="outline-text-3" id="text-10-5">
<div class="org-src-container">
<pre class="src src-matlab">nx = length(n_acc);
na = 16;
win = hanning(floor(nx/na));
[p_acc, f] = pwelch(n_acc, win, 0, [], Fs);
[p_geo, ~] = pwelch(n_geo, win, 0, [], Fs);
[p_ss, ~] = pwelch(n_acc_filt + n_geo_filt, win, 0, [], Fs);
</pre>
</div>
</div>
</div>
<div id="outline-container-org934b67a" class="outline-3">
<h3 id="org934b67a"><span class="section-number-3">10.6</span> Transfer function of the super sensor</h3>
<div class="outline-text-3" id="text-10-6">
<div class="org-src-container">
<pre class="src src-matlab">bodeFig({s*C_acc*G_acc, C_geo*G_geo, s*C_acc*G_acc*H1+C_geo*G_geo*H2}, struct('phase', true))
</pre>
</div>
</div>
</div>
</div>
<p>
</p>
<style>.csl-entry{text-indent: -1.5em; margin-left: 1.5em;}</style><h2 class='citeproc-org-bib-h2'>Bibliography</h2>
<div class="csl-bib-body">
<div class="csl-entry"><a name="citeproc_bib_item_1"></a>Baerveldt, A.-J., and R. Klang. 1997. “A Low-Cost and Low-Weight Attitude Estimation System for an Autonomous Helicopter.” In <i>Proceedings of IEEE International Conference on Intelligent Engineering Systems</i>, nil. <a href="https://doi.org/10.1109/ines.1997.632450">https://doi.org/10.1109/ines.1997.632450</a>.</div>
<div class="csl-entry"><a name="citeproc_bib_item_2"></a>Barzilai, Aaron, Tom VanZandt, and Tom Kenny. 1998. “Technique for Measurement of the Noise of a Sensor in the Presence of Large Background Signals.” <i>Review of Scientific Instruments</i> 69 (7):276772. <a href="https://doi.org/10.1063/1.1149013">https://doi.org/10.1063/1.1149013</a>.</div>
<div class="csl-entry"><a name="citeproc_bib_item_3"></a>Bendat, J. 1957. “Optimum Filters for Independent Measurements of Two Related Perturbed Messages.” <i>IRE Transactions on Circuit Theory</i>, --. <a href="https://doi.org/10.1109/tct.1957.1086345">https://doi.org/10.1109/tct.1957.1086345</a>.</div>
<div class="csl-entry"><a name="citeproc_bib_item_4"></a>Corke, Peter. 2004. “An Inertial and Visual Sensing System for a Small Autonomous Helicopter.” <i>Journal of Robotic Systems</i> 21 (2):4351. <a href="https://doi.org/10.1002/rob.10127">https://doi.org/10.1002/rob.10127</a>.</div>
<div class="csl-entry"><a name="citeproc_bib_item_5"></a>Jensen, Austin, Cal Coopmans, and YangQuan Chen. 2013. “Basics and Guidelines of Complementary Filters for Small UAS Navigation.” In <i>2013 International Conference on Unmanned Aircraft Systems (ICUAS)</i>, nil. <a href="https://doi.org/10.1109/icuas.2013.6564726">https://doi.org/10.1109/icuas.2013.6564726</a>.</div>
<div class="csl-entry"><a name="citeproc_bib_item_6"></a>Min, Hyung Gi, and Eun Tae Jeung. 2015. “Complementary Filter Design for Angle Estimation Using Mems Accelerometer and Gyroscope.” <i>Department of Control and Instrumentation, Changwon National University, Changwon, Korea</i>, 641773.</div>
<div class="csl-entry"><a name="citeproc_bib_item_7"></a>Moore, Steven Ian, Andrew J. Fleming, and Yuen Kuan Yong. 2019. “Capacitive Instrumentation and Sensor Fusion for High-Bandwidth Nanopositioning.” <i>IEEE Sensors Letters</i> 3 (8):13. <a href="https://doi.org/10.1109/lsens.2019.2933065">https://doi.org/10.1109/lsens.2019.2933065</a>.</div>
<div class="csl-entry"><a name="citeproc_bib_item_8"></a>Plummer, A. R. 2006. “Optimal Complementary Filters and Their Application in Motion Measurement.” <i>Proceedings of the Institution of Mechanical Engineers, Part I: Journal of Systems and Control Engineering</i> 220 (6):489507. <a href="https://doi.org/10.1243/09596518JSCE229">https://doi.org/10.1243/09596518JSCE229</a>.</div>
<div class="csl-entry"><a name="citeproc_bib_item_9"></a>Robert Grover Brown, Patrick Y. C. Hwang. 2012. <i>Introduction to Random Signals and Applied Kalman Filtering with Matlab Exercises</i>. 4th ed. Wiley.</div>
<div class="csl-entry"><a name="citeproc_bib_item_10"></a>Shaw, F.R., and K. Srinivasan. 1990. “Bandwidth Enhancement of Position Measurements Using Measured Acceleration.” <i>Mechanical Systems and Signal Processing</i> 4 (1):2338. <a href="https://doi.org/10.1016/0888-3270(90)90038-m">https://doi.org/10.1016/0888-3270(90)90038-m</a>.</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2020-09-28 lun. 17:27</p>
</div>
</body>
</html>