dehaeze21_desig_compl_filte/matlab/dehaeze21_desig_compl_filte_matlab.html

1110 lines
54 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>
<!-- 2021-09-01 mer. 11:26 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>A new method of designing complementary filters for sensor fusion using the $\mathcal{H}_\infty$ synthesis - Matlab Computation</title>
<meta name="author" content="Thomas Dehaeze" />
<meta name="generator" content="Org Mode" />
<link rel="stylesheet" type="text/css" href="https://research.tdehaeze.xyz/css/style.css"/>
<script type="text/javascript" src="https://research.tdehaeze.xyz/js/script.js"></script>
<script>
MathJax = {
svg: {
scale: 1,
fontCache: "global"
},
tex: {
tags: "ams",
multlineWidth: "%MULTLINEWIDTH",
tagSide: "right",
macros: {bm: ["\\boldsymbol{#1}",1],},
tagIndent: ".8em"
}
};
</script>
<script id="MathJax-script" async
src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.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" class="content">
<h1 class="title">A new method of designing complementary filters for sensor fusion using the \(\mathcal{H}_\infty\) synthesis - Matlab Computation</h1>
<div id="table-of-contents" role="doc-toc">
<h2>Table of Contents</h2>
<div id="text-table-of-contents" role="doc-toc">
<ul>
<li><a href="#sec:h_inf_synthesis_complementary_filters">1. H-Infinity synthesis of complementary filters</a>
<ul>
<li><a href="#org28b234a">1.1. Synthesis Architecture</a></li>
<li><a href="#orgc93cb4f">1.2. Design of Weighting Function</a></li>
<li><a href="#orgc13c431">1.3. Example</a></li>
<li><a href="#org5193725">1.4. H-Infinity Synthesis</a></li>
<li><a href="#org6a8a935">1.5. Obtained Complementary Filters</a></li>
</ul>
</li>
<li><a href="#sec:comp_filters_ligo">2. Design of complementary filters used in the Active Vibration Isolation System at the LIGO</a>
<ul>
<li><a href="#orgd799207">2.1. Specifications</a></li>
<li><a href="#org9c4e94b">2.2. FIR Filter</a></li>
<li><a href="#orgf319576">2.3. Weights</a></li>
<li><a href="#orgd6a3fe8">2.4. H-Infinity Synthesis</a></li>
<li><a href="#org7dd3e80">2.5. Compare FIR and H-Infinity Filters</a></li>
</ul>
</li>
<li><a href="#sec:closed_loop_complementary_filters">3. &ldquo;Closed-Loop&rdquo; complementary filters</a>
<ul>
<li><a href="#org63f6ef1">3.1. Using Feedback architecture</a></li>
</ul>
</li>
<li><a href="#sec:three_comp_filters">4. Synthesis of three complementary filters</a>
<ul>
<li><a href="#org56f444d">4.1. Theory</a></li>
<li><a href="#orga0b98b5">4.2. Weights</a></li>
<li><a href="#orgc61bfb8">4.3. H-Infinity Synthesis</a></li>
<li><a href="#org1db94f4">4.4. Obtained Complementary Filters</a></li>
</ul>
</li>
<li><a href="#sec:functions">5. Functions</a>
<ul>
<li><a href="#org45afa96">5.1. <code>generateWF</code>: Generate Weighting Functions</a>
<ul>
<li><a href="#orgd2a9c04">Function description</a></li>
<li><a href="#org603cf67">Optional Parameters</a></li>
<li><a href="#org01be6d3">Generate the Weighting function</a></li>
<li><a href="#org61ff351">Verification of the \(G_0\), \(G_c\) and \(G_\infty\) gains</a></li>
</ul>
</li>
<li><a href="#orga2379de">5.2. <code>generateCF</code>: Generate Complementary Filters</a>
<ul>
<li><a href="#org9330a28">Function description</a></li>
<li><a href="#org273e9cb">Optional Parameters</a></li>
<li><a href="#org13f31c2">H-Infinity Synthesis</a></li>
</ul>
</li>
</ul>
</li>
</ul>
</div>
</div>
<p>
This file is the Matlab file for the paper (<a href="#citeproc_bib_item_1">Dehaeze, Vermat, and Collette 2021</a>).
</p>
<p>
This document is divided into several sections:
</p>
<ul class="org-ul">
<li>in section <a href="#sec:h_inf_synthesis_complementary_filters">1</a>, the \(\mathcal{H}_\infty\) synthesis is used for generating two complementary filters</li>
<li>in section <a href="#sec:three_comp_filters">4</a>, a method using the \(\mathcal{H}_\infty\) synthesis is proposed to shape three of more complementary filters</li>
<li>in section <a href="#sec:comp_filters_ligo">2</a>, the \(\mathcal{H}_\infty\) synthesis is used and compared with FIR complementary filters used for LIGO</li>
<li>in section <a href="#sec:closed_loop_complementary_filters">3</a></li>
</ul>
<div id="outline-container-sec:h_inf_synthesis_complementary_filters" class="outline-2">
<h2 id="sec:h_inf_synthesis_complementary_filters"><span class="section-number-2">1.</span> H-Infinity synthesis of complementary filters</h2>
<div class="outline-text-2" id="text-sec:h_inf_synthesis_complementary_filters">
<div class="note" id="org37907f0">
<p>
The Matlab file corresponding to this section is accessible <a href="matlab/1_synthesis_complementary_filters.m">here</a>.
</p>
</div>
</div>
<div id="outline-container-org28b234a" class="outline-3">
<h3 id="org28b234a"><span class="section-number-3">1.1.</span> Synthesis Architecture</h3>
<div class="outline-text-3" id="text-1-1">
<p>
We here synthesize two complementary filters using the \(\mathcal{H}_\infty\) synthesis.
The goal is to specify upper bounds on the norms of the two complementary filters \(H_1(s)\) and \(H_2(s)\) while ensuring their complementary property (\(H_1(s) + H_2(s) = 1\)).
</p>
<p>
In order to do so, we use the generalized plant shown on figure <a href="#org182c400">1</a> where \(W_1(s)\) and \(W_2(s)\) are weighting transfer functions that will be used to shape \(H_1(s)\) and \(H_2(s)\) respectively.
</p>
<div id="org182c400" class="figure">
<p><img src="figs-journal/h_infinity_robust_fusion_plant.png" alt="h_infinity_robust_fusion_plant.png" />
</p>
<p><span class="figure-number">Figure 1: </span>\(\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_2\) (figure <a href="#org182c400">1</a>) such that the \(\mathcal{H}_\infty\) norm of the transfer function from \(w\) to \([z_1,\ z_2]\) is less than one:
\[ \left\| \begin{array}{c} (1 - H_2(s)) W_1(s) \\ H_2(s) W_2(s) \end{array} \right\|_\infty < 1 \]
</p>
<p>
Thus, if the above condition is verified, we can define \(H_1(s) = 1 - H_2(s)\) and we have that:
\[ \left\| \begin{array}{c} H_1(s) W_1(s) \\ H_2(s) W_2(s) \end{array} \right\|_\infty < 1 \]
Which is almost (with an maximum error of \(\sqrt{2}\)) equivalent to:
</p>
\begin{align*}
|H_1(j\omega)| &< \frac{1}{|W_1(j\omega)|}, \quad \forall \omega \\
|H_2(j\omega)| &< \frac{1}{|W_2(j\omega)|}, \quad \forall \omega
\end{align*}
<p>
We then see that \(W_1(s)\) and \(W_2(s)\) can be used to shape both \(H_1(s)\) and \(H_2(s)\) while ensuring their complementary property by the definition of \(H_1(s) = 1 - H_2(s)\).
</p>
</div>
</div>
<div id="outline-container-orgc93cb4f" class="outline-3">
<h3 id="orgc93cb4f"><span class="section-number-3">1.2.</span> Design of Weighting Function</h3>
<div class="outline-text-3" id="text-1-2">
<p>
A formula is proposed to help the design of the weighting functions:
</p>
\begin{equation}
W(s) = \left( \frac{
\frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{G_0}{G_c}\right)^{\frac{1}{n}}
}{
\left(\frac{1}{G_\infty}\right)^{\frac{1}{n}} \frac{1}{\omega_0} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{1}{G_c}\right)^{\frac{1}{n}}
}\right)^n
\end{equation}
<p>
The parameters permits to specify:
</p>
<ul class="org-ul">
<li>the low frequency gain: \(G_0 = lim_{\omega \to 0} |W(j\omega)|\)</li>
<li>the high frequency gain: \(G_\infty = lim_{\omega \to \infty} |W(j\omega)|\)</li>
<li>the absolute gain at \(\omega_0\): \(G_c = |W(j\omega_0)|\)</li>
<li>the absolute slope between high and low frequency: \(n\)</li>
</ul>
<p>
The general shape of a weighting function generated using the formula is shown in figure <a href="#org36e64c3">2</a>.
</p>
<div id="org36e64c3" class="figure">
<p><img src="figs/weight_formula.png" alt="weight_formula.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Gain of the Weighting Function formula</p>
</div>
</div>
</div>
<div id="outline-container-orgc13c431" class="outline-3">
<h3 id="orgc13c431"><span class="section-number-3">1.3.</span> Example</h3>
<div class="outline-text-3" id="text-1-3">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Design of the Weighting Functions</span>
W1 = generateWF(<span class="org-string">'n'</span>, 3, <span class="org-string">'w0'</span>, 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>10, <span class="org-string">'G0'</span>, 1000, <span class="org-string">'Ginf'</span>, 1<span class="org-builtin">/</span>10, <span class="org-string">'Gc'</span>, 0.45);
W2 = generateWF(<span class="org-string">'n'</span>, 2, <span class="org-string">'w0'</span>, 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>10, <span class="org-string">'G0'</span>, 1<span class="org-builtin">/</span>10, <span class="org-string">'Ginf'</span>, 1000, <span class="org-string">'Gc'</span>, 0.45);
</pre>
</div>
<div id="orgae25882" class="figure">
<p><img src="figs/weights_W1_W2.png" alt="weights_W1_W2.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Weights on the complementary filters \(W_1\) and \(W_2\) and the associated performance weights</p>
</div>
</div>
</div>
<div id="outline-container-org5193725" class="outline-3">
<h3 id="org5193725"><span class="section-number-3">1.4.</span> H-Infinity Synthesis</h3>
<div class="outline-text-3" id="text-1-4">
<p>
We define the generalized plant \(P\) on matlab.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generalized Plant</span>
P = [W1 <span class="org-builtin">-</span>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"><span class="org-matlab-cellbreak">%% H-Infinity Synthesis</span>
[H2, <span class="org-builtin">~</span>, gamma, <span class="org-builtin">~</span>] = hinfsyn(P, 1, 1,<span class="org-string">'TOLGAM'</span>, 0.001, <span class="org-string">'METHOD'</span>, <span class="org-string">'ric'</span>, <span class="org-string">'DISPLAY'</span>, <span class="org-string">'on'</span>);
</pre>
</div>
<pre class="example" id="orgc3d665b">
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
Test bounds: 0.3223 &lt;= gamma &lt;= 1000
gamma X&gt;=0 Y&gt;=0 rho(XY)&lt;1 p/f
1.795e+01 1.4e-07 0.0e+00 1.481e-16 p
2.406e+00 1.4e-07 0.0e+00 3.604e-15 p
8.806e-01 -3.1e+02 # -1.4e-16 7.370e-19 f
1.456e+00 1.4e-07 0.0e+00 1.499e-18 p
1.132e+00 1.4e-07 0.0e+00 8.587e-15 p
9.985e-01 1.4e-07 0.0e+00 2.331e-13 p
9.377e-01 -7.7e+02 # -6.6e-17 3.744e-14 f
9.676e-01 -2.0e+03 # -5.7e-17 1.046e-13 f
9.829e-01 -6.6e+03 # -1.1e-16 2.949e-13 f
9.907e-01 1.4e-07 0.0e+00 2.374e-19 p
9.868e-01 -1.6e+04 # -6.4e-17 5.331e-14 f
9.887e-01 -5.1e+04 # -1.5e-17 2.703e-19 f
9.897e-01 1.4e-07 0.0e+00 1.583e-11 p
Limiting gains...
9.897e-01 1.5e-07 0.0e+00 1.183e-12 p
9.897e-01 6.9e-07 0.0e+00 1.365e-12 p
Best performance (actual): 0.9897
</pre>
<p>
We then define the high pass filter \(H_1 = 1 - H_2\). The bode plot of both \(H_1\) and \(H_2\) is shown on figure <a href="#orgbe477a8">4</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Define H1 to be the complementary of H2</span>
H1 = 1 <span class="org-builtin">-</span> H2;
</pre>
</div>
<p>
Or one can just used to <code>generateCF</code> Matlab function:
</p>
<div class="org-src-container">
<pre class="src src-matlab">[H1, H2] = generateCF(W1, W2);
</pre>
</div>
</div>
</div>
<div id="outline-container-org6a8a935" class="outline-3">
<h3 id="org6a8a935"><span class="section-number-3">1.5.</span> Obtained Complementary Filters</h3>
<div class="outline-text-3" id="text-1-5">
<p>
The obtained complementary filters are shown on figure <a href="#orgbe477a8">4</a>.
</p>
<pre class="example" id="org9c90b25">
zpk(H1)
ans =
(s+1.289e05) (s+153.6) (s+3.842)^3
-------------------------------------------------------
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
zpk(H2)
ans =
125.61 (s+3358)^2 (s^2 + 46.61s + 813.8)
-------------------------------------------------------
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
</pre>
<div id="orgbe477a8" class="figure">
<p><img src="figs/hinf_filters_results.png" alt="hinf_filters_results.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Obtained complementary filters using \(\mathcal{H}_\infty\) synthesis</p>
</div>
</div>
</div>
</div>
<div id="outline-container-sec:comp_filters_ligo" class="outline-2">
<h2 id="sec:comp_filters_ligo"><span class="section-number-2">2.</span> Design of complementary filters used in the Active Vibration Isolation System at the LIGO</h2>
<div class="outline-text-2" id="text-sec:comp_filters_ligo">
<div class="note" id="orge607958">
<p>
The Matlab file corresponding to this section is accessible <a href="matlab/2_ligo_complementary_filters.m">here</a>.
</p>
</div>
<p>
Let&rsquo;s try to design complementary filters that are corresponding to the complementary filters design for the LIGO and described in (<a href="#citeproc_bib_item_2">Hua 2005</a>).
</p>
<p>
The FIR complementary filters designed in (<a href="#citeproc_bib_item_2">Hua 2005</a>) are of order 512.
</p>
</div>
<div id="outline-container-orgd799207" class="outline-3">
<h3 id="orgd799207"><span class="section-number-3">2.1.</span> Specifications</h3>
<div class="outline-text-3" id="text-2-1">
<p>
The specifications for the filters are:
</p>
<ol class="org-ol">
<li>From \(0\) to \(0.008\text{ Hz}\),the magnitude of the filters transfer function should be less than or equal to \(8 \times 10^{-3}\)</li>
<li>From \(0.008\text{ Hz}\) to \(0.04\text{ Hz}\), it attenuates the input signal proportional to frequency cubed</li>
<li>Between \(0.04\text{ Hz}\) and \(0.1\text{ Hz}\), the magnitude of the transfer function should be less than 3</li>
<li>Above \(0.1\text{ Hz}\), the maximum of the magnitude of the complement filter should be as close to zero as possible. In our system, we would like to have the magnitude of the complementary filter to be less than \(0.1\). As the filters obtained in (<a href="#citeproc_bib_item_2">Hua 2005</a>) have a magnitude of \(0.045\), we will set that as our requirement</li>
</ol>
<p>
The specifications are translated in upper bounds of the complementary filters are shown on figure <a href="#org8f6f47c">5</a>.
</p>
<div id="org8f6f47c" class="figure">
<p><img src="figs/ligo_specifications.png" alt="ligo_specifications.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Specification for the LIGO complementary filters</p>
</div>
</div>
</div>
<div id="outline-container-org9c4e94b" class="outline-3">
<h3 id="org9c4e94b"><span class="section-number-3">2.2.</span> FIR Filter</h3>
<div class="outline-text-3" id="text-2-2">
<p>
We here try to implement the FIR complementary filter synthesis as explained in (<a href="#citeproc_bib_item_2">Hua 2005</a>).
For that, we use the <a href="http://cvxr.com/cvx/">CVX matlab Toolbox</a>.
</p>
<p>
We setup the CVX toolbox and use the <code>SeDuMi</code> solver.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Initialized CVX</span>
cvx_startup;
cvx_solver sedumi;
</pre>
</div>
<p>
We define the frequency vectors on which we will constrain the norm of the FIR filter.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Frequency vectors</span>
w1 = 0<span class="org-builtin">:</span>4.06e<span class="org-builtin">-</span>4<span class="org-builtin">:</span>0.008;
w2 = 0.008<span class="org-builtin">:</span>4.06e<span class="org-builtin">-</span>4<span class="org-builtin">:</span>0.04;
w3 = 0.04<span class="org-builtin">:</span>8.12e<span class="org-builtin">-</span>4<span class="org-builtin">:</span>0.1;
w4 = 0.1<span class="org-builtin">:</span>8.12e<span class="org-builtin">-</span>4<span class="org-builtin">:</span>0.83;
</pre>
</div>
<p>
We then define the order of the FIR filter.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Filter order</span>
n = 512;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Initialization of filter responses</span>
A1 = [ones(length(w1),1), cos(kron(w1<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
A2 = [ones(length(w2),1), cos(kron(w2<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
A3 = [ones(length(w3),1), cos(kron(w3<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
A4 = [ones(length(w4),1), cos(kron(w4<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
B1 = [zeros(length(w1),1), sin(kron(w1<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
B2 = [zeros(length(w2),1), sin(kron(w2<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
B3 = [zeros(length(w3),1), sin(kron(w3<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
B4 = [zeros(length(w4),1), sin(kron(w4<span class="org-builtin">'.*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>),[1<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))];
</pre>
</div>
<p>
We run the convex optimization.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Convex optimization</span>
cvx_begin
variable y(n<span class="org-builtin">+</span>1,1)
<span class="org-comment-delimiter">% </span><span class="org-comment">t</span>
maximize(<span class="org-builtin">-</span>y(1))
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(w1)</span>
norm([0 A1(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>); 0 B1(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>y) <span class="org-builtin">&lt;=</span> 8e<span class="org-builtin">-</span>3;
<span class="org-keyword">end</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(w2)</span>
norm([0 A2(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>); 0 B2(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>y) <span class="org-builtin">&lt;=</span> 8e<span class="org-builtin">-</span>3<span class="org-builtin">*</span>(2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>w2(<span class="org-matlab-math">i</span>)<span class="org-builtin">/</span>(0.008<span class="org-builtin">*</span>2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>))<span class="org-builtin">^</span>3;
<span class="org-keyword">end</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(w3)</span>
norm([0 A3(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>); 0 B3(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>y) <span class="org-builtin">&lt;=</span> 3;
<span class="org-keyword">end</span>
<span class="org-keyword">for</span> <span class="org-variable-name"><span class="org-matlab-math">i</span></span> = <span class="org-constant">1:length(w4)</span>
norm([[1 0]<span class="org-builtin">'-</span> [0 A4(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>); 0 B4(<span class="org-matlab-math">i</span>,<span class="org-builtin">:</span>)]<span class="org-builtin">*</span>y]) <span class="org-builtin">&lt;=</span> y(1);
<span class="org-keyword">end</span>
cvx_end
h = y(2<span class="org-builtin">:</span>end);
</pre>
</div>
<pre class="example" id="org345f752">
cvx_begin
variable y(n+1,1)
% t
maximize(-y(1))
for i = 1:length(w1)
norm([0 A1(i,:); 0 B1(i,:)]*y) &lt;= 8e-3;
end
for i = 1:length(w2)
norm([0 A2(i,:); 0 B2(i,:)]*y) &lt;= 8e-3*(2*pi*w2(i)/(0.008*2*pi))^3;
end
for i = 1:length(w3)
norm([0 A3(i,:); 0 B3(i,:)]*y) &lt;= 3;
end
for i = 1:length(w4)
norm([[1 0]'- [0 A4(i,:); 0 B4(i,:)]*y]) &lt;= y(1);
end
cvx_end
Calling SeDuMi 1.34: 4291 variables, 1586 equality constraints
For improved efficiency, SeDuMi is solving the dual problem.
------------------------------------------------------------
SeDuMi 1.34 (beta) by AdvOL, 2005-2008 and Jos F. Sturm, 1998-2003.
Alg = 2: xz-corrector, Adaptive Step-Differentiation, theta = 0.250, beta = 0.500
eqs m = 1586, order n = 3220, dim = 4292, blocks = 1073
nnz(A) = 1100727 + 0, nnz(ADA) = 1364794, nnz(L) = 683190
it : b*y gap delta rate t/tP* t/tD* feas cg cg prec
0 : 4.11E+02 0.000
1 : -2.58E+00 1.25E+02 0.000 0.3049 0.9000 0.9000 4.87 1 1 3.0E+02
2 : -2.36E+00 3.90E+01 0.000 0.3118 0.9000 0.9000 1.83 1 1 6.6E+01
3 : -1.69E+00 1.31E+01 0.000 0.3354 0.9000 0.9000 1.76 1 1 1.5E+01
4 : -8.60E-01 7.10E+00 0.000 0.5424 0.9000 0.9000 2.48 1 1 4.8E+00
5 : -4.91E-01 5.44E+00 0.000 0.7661 0.9000 0.9000 3.12 1 1 2.5E+00
6 : -2.96E-01 3.88E+00 0.000 0.7140 0.9000 0.9000 2.62 1 1 1.4E+00
7 : -1.98E-01 2.82E+00 0.000 0.7271 0.9000 0.9000 2.14 1 1 8.5E-01
8 : -1.39E-01 2.00E+00 0.000 0.7092 0.9000 0.9000 1.78 1 1 5.4E-01
9 : -9.99E-02 1.30E+00 0.000 0.6494 0.9000 0.9000 1.51 1 1 3.3E-01
10 : -7.57E-02 8.03E-01 0.000 0.6175 0.9000 0.9000 1.31 1 1 2.0E-01
11 : -5.99E-02 4.22E-01 0.000 0.5257 0.9000 0.9000 1.17 1 1 1.0E-01
12 : -5.28E-02 2.45E-01 0.000 0.5808 0.9000 0.9000 1.08 1 1 5.9E-02
13 : -4.82E-02 1.28E-01 0.000 0.5218 0.9000 0.9000 1.05 1 1 3.1E-02
14 : -4.56E-02 5.65E-02 0.000 0.4417 0.9045 0.9000 1.02 1 1 1.4E-02
15 : -4.43E-02 2.41E-02 0.000 0.4265 0.9004 0.9000 1.01 1 1 6.0E-03
16 : -4.37E-02 8.90E-03 0.000 0.3690 0.9070 0.9000 1.00 1 1 2.3E-03
17 : -4.35E-02 3.24E-03 0.000 0.3641 0.9164 0.9000 1.00 1 1 9.5E-04
18 : -4.34E-02 1.55E-03 0.000 0.4788 0.9086 0.9000 1.00 1 1 4.7E-04
19 : -4.34E-02 8.77E-04 0.000 0.5653 0.9169 0.9000 1.00 1 1 2.8E-04
20 : -4.34E-02 5.05E-04 0.000 0.5754 0.9034 0.9000 1.00 1 1 1.6E-04
21 : -4.34E-02 2.94E-04 0.000 0.5829 0.9136 0.9000 1.00 1 1 9.9E-05
22 : -4.34E-02 1.63E-04 0.015 0.5548 0.9000 0.0000 1.00 1 1 6.6E-05
23 : -4.33E-02 9.42E-05 0.000 0.5774 0.9053 0.9000 1.00 1 1 3.9E-05
24 : -4.33E-02 6.27E-05 0.000 0.6658 0.9148 0.9000 1.00 1 1 2.6E-05
25 : -4.33E-02 3.75E-05 0.000 0.5972 0.9187 0.9000 1.00 1 1 1.6E-05
26 : -4.33E-02 1.89E-05 0.000 0.5041 0.9117 0.9000 1.00 1 1 8.6E-06
27 : -4.33E-02 9.72E-06 0.000 0.5149 0.9050 0.9000 1.00 1 1 4.5E-06
28 : -4.33E-02 2.94E-06 0.000 0.3021 0.9194 0.9000 1.00 1 1 1.5E-06
29 : -4.33E-02 9.73E-07 0.000 0.3312 0.9189 0.9000 1.00 2 2 5.3E-07
30 : -4.33E-02 2.82E-07 0.000 0.2895 0.9063 0.9000 1.00 2 2 1.6E-07
31 : -4.33E-02 8.05E-08 0.000 0.2859 0.9049 0.9000 1.00 2 2 4.7E-08
32 : -4.33E-02 1.43E-08 0.000 0.1772 0.9059 0.9000 1.00 2 2 8.8E-09
iter seconds digits c*x b*y
32 49.4 6.8 -4.3334083581e-02 -4.3334090214e-02
|Ax-b| = 3.7e-09, [Ay-c]_+ = 1.1E-10, |x|= 1.0e+00, |y|= 2.6e+00
Detailed timing (sec)
Pre IPM Post
3.902E+00 4.576E+01 1.035E-02
Max-norms: ||b||=1, ||c|| = 3,
Cholesky |add|=0, |skip| = 0, ||L.L|| = 4.26267.
------------------------------------------------------------
Status: Solved
Optimal value (cvx_optval): -0.0433341
h = y(2:end);
</pre>
<p>
Finally, we compute the filter response over the frequency vector defined and the result is shown on figure <a href="#orgef7e332">6</a> which is very close to the filters obtain in (<a href="#citeproc_bib_item_2">Hua 2005</a>).
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Combine the frequency vectors to form the obtained filter</span>
w = [w1 w2 w3 w4];
H = [exp(<span class="org-builtin">-</span><span class="org-matlab-math">j</span><span class="org-builtin">*</span>kron(w<span class="org-builtin">'.*</span>2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span>,[0<span class="org-builtin">:</span>n<span class="org-builtin">-</span>1]))]<span class="org-builtin">*</span>h;
</pre>
</div>
<div id="orgef7e332" class="figure">
<p><img src="figs/fir_filter_ligo.png" alt="fir_filter_ligo.png" />
</p>
<p><span class="figure-number">Figure 6: </span>FIR Complementary filters obtain after convex optimization</p>
</div>
</div>
</div>
<div id="outline-container-orgf319576" class="outline-3">
<h3 id="orgf319576"><span class="section-number-3">2.3.</span> Weights</h3>
<div class="outline-text-3" id="text-2-3">
<p>
We design weights that will be used for the \(\mathcal{H}_\infty\) synthesis of the complementary filters.
These weights will determine the order of the obtained filters.
Here are the requirements on the filters:
</p>
<ul class="org-ul">
<li>reasonable order</li>
<li>to be as close as possible to the specified upper bounds</li>
<li>stable minimum phase</li>
</ul>
<p>
The bode plot of the weights is shown on figure <a href="#orgade85b1">7</a>.
</p>
<div id="orgade85b1" class="figure">
<p><img src="figs/ligo_weights.png" alt="ligo_weights.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Weights for the \(\mathcal{H}_\infty\) synthesis</p>
</div>
</div>
</div>
<div id="outline-container-orgd6a3fe8" class="outline-3">
<h3 id="orgd6a3fe8"><span class="section-number-3">2.4.</span> H-Infinity Synthesis</h3>
<div class="outline-text-3" id="text-2-4">
<p>
We define the generalized plant as shown on figure <a href="#org182c400">1</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generalized plant for the H-infinity Synthesis</span>
P = [0 wL;
wH <span class="org-builtin">-</span>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"><span class="org-matlab-cellbreak">%% Standard H-Infinity synthesis</span>
[Hl, <span class="org-builtin">~</span>, gamma, <span class="org-builtin">~</span>] = hinfsyn(P, 1, 1,<span class="org-string">'TOLGAM'</span>, 0.001, <span class="org-string">'METHOD'</span>, <span class="org-string">'ric'</span>, <span class="org-string">'DISPLAY'</span>, <span class="org-string">'on'</span>);
</pre>
</div>
<pre class="example" id="org9f905bf">
[Hl, ~, 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.3276 &lt; gamma &lt;= 1.8063
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
1.806 1.4e-02 -1.7e-16 3.6e-03 -4.8e-12 0.0000 p
1.067 1.3e-02 -4.2e-14 3.6e-03 -1.9e-12 0.0000 p
0.697 1.3e-02 -3.0e-01# 3.6e-03 -3.5e-11 0.0000 f
0.882 1.3e-02 -9.5e-01# 3.6e-03 -1.2e-34 0.0000 f
0.975 1.3e-02 -2.7e+00# 3.6e-03 -1.6e-12 0.0000 f
1.021 1.3e-02 -8.7e+00# 3.6e-03 -4.5e-16 0.0000 f
1.044 1.3e-02 -6.5e-14 3.6e-03 -3.0e-15 0.0000 p
1.032 1.3e-02 -1.8e+01# 3.6e-03 0.0e+00 0.0000 f
1.038 1.3e-02 -3.8e+01# 3.6e-03 0.0e+00 0.0000 f
1.041 1.3e-02 -8.3e+01# 3.6e-03 -2.9e-33 0.0000 f
1.042 1.3e-02 -1.9e+02# 3.6e-03 -3.4e-11 0.0000 f
1.043 1.3e-02 -5.3e+02# 3.6e-03 -7.5e-13 0.0000 f
Gamma value achieved: 1.0439
</pre>
<p>
The high pass filter is defined as \(H_H = 1 - H_L\).
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% High pass filter as the complementary of the low pass filter</span>
Hh = 1 <span class="org-builtin">-</span> Hl;
</pre>
</div>
<p>
The size of the filters is shown below.
</p>
<pre class="example" id="orgf857bcc">
size(Hh), size(Hl)
State-space model with 1 outputs, 1 inputs, and 27 states.
State-space model with 1 outputs, 1 inputs, and 27 states.
</pre>
<p>
The bode plot of the obtained filters as shown on figure <a href="#org064ef13">8</a>.
</p>
<div id="org064ef13" class="figure">
<p><img src="figs/hinf_synthesis_ligo_results.png" alt="hinf_synthesis_ligo_results.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Obtained complementary filters using the \(\mathcal{H}_\infty\) synthesis</p>
</div>
</div>
</div>
<div id="outline-container-org7dd3e80" class="outline-3">
<h3 id="org7dd3e80"><span class="section-number-3">2.5.</span> Compare FIR and H-Infinity Filters</h3>
<div class="outline-text-3" id="text-2-5">
<p>
Let&rsquo;s now compare the FIR filters designed in (<a href="#citeproc_bib_item_2">Hua 2005</a>) and the one obtained with the \(\mathcal{H}_\infty\) synthesis on figure <a href="#orgf0918a6">9</a>.
</p>
<div id="orgf0918a6" class="figure">
<p><img src="figs/comp_fir_ligo_hinf.png" alt="comp_fir_ligo_hinf.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Comparison between the FIR filters developped for LIGO and the \(\mathcal{H}_\infty\) complementary filters</p>
</div>
</div>
</div>
</div>
<div id="outline-container-sec:closed_loop_complementary_filters" class="outline-2">
<h2 id="sec:closed_loop_complementary_filters"><span class="section-number-2">3.</span> &ldquo;Closed-Loop&rdquo; complementary filters</h2>
<div class="outline-text-2" id="text-sec:closed_loop_complementary_filters">
<div class="note" id="org7a8d1c5">
<p>
The Matlab file corresponding to this section is accessible <a href="matlab/3_closed_loop_complementary_filters.m">here</a>.
</p>
</div>
</div>
<div id="outline-container-org63f6ef1" class="outline-3">
<h3 id="org63f6ef1"><span class="section-number-3">3.1.</span> Using Feedback architecture</h3>
<div class="outline-text-3" id="text-3-1">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Design of the Weighting Functions</span>
W1 = generateWF(<span class="org-string">'n'</span>, 3, <span class="org-string">'w0'</span>, 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>10, <span class="org-string">'G0'</span>, 1000, <span class="org-string">'Ginf'</span>, 1<span class="org-builtin">/</span>10, <span class="org-string">'Gc'</span>, 0.45);
W2 = generateWF(<span class="org-string">'n'</span>, 2, <span class="org-string">'w0'</span>, 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>10, <span class="org-string">'G0'</span>, 1<span class="org-builtin">/</span>10, <span class="org-string">'Ginf'</span>, 1000, <span class="org-string">'Gc'</span>, 0.45);
</pre>
</div>
<p>
Let&rsquo;s first synthesize \(H_1(s)\):
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generalized plant for "closed-loop" complementary filter synthesis</span>
P = [ W1 0 1;
<span class="org-builtin">-</span>W1 W2 <span class="org-builtin">-</span>1];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Standard H-Infinity Synthesis</span>
[L, <span class="org-builtin">~</span>, gamma, <span class="org-builtin">~</span>] = hinfsyn(P, 1, 1,<span class="org-string">'TOLGAM'</span>, 0.001, <span class="org-string">'METHOD'</span>, <span class="org-string">'ric'</span>, <span class="org-string">'DISPLAY'</span>, <span class="org-string">'on'</span>);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Complementary filters</span>
H1 = inv(1 <span class="org-builtin">+</span> L);
H2 = 1 <span class="org-builtin">-</span> H1;
</pre>
</div>
<pre class="example" id="orga6d94dc">
zpk(H1) =
(s+3.842)^3 (s+153.6) (s+1.289e05)
-------------------------------------------------------
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
zpk(H2) =
125.61 (s+3358)^2 (s^2 + 46.61s + 813.8)
-------------------------------------------------------
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
</pre>
<div id="org28f9a2d" class="figure">
<p><img src="figs/hinf_filters_results_mixed_sensitivity.png" alt="hinf_filters_results_mixed_sensitivity.png" />
</p>
</div>
</div>
</div>
</div>
<div id="outline-container-sec:three_comp_filters" class="outline-2">
<h2 id="sec:three_comp_filters"><span class="section-number-2">4.</span> Synthesis of three complementary filters</h2>
<div class="outline-text-2" id="text-sec:three_comp_filters">
<div class="note" id="orgbc97d34">
<p>
The Matlab file corresponding to this section is accessible <a href="matlab/4_three_complementary_filters.m">here</a>.
</p>
</div>
</div>
<div id="outline-container-org56f444d" class="outline-3">
<h3 id="org56f444d"><span class="section-number-3">4.1.</span> Theory</h3>
<div class="outline-text-3" id="text-4-1">
<p>
We want:
</p>
\begin{align*}
& |H_1(j\omega)| < 1/|W_1(j\omega)|, \quad \forall\omega\\
& |H_2(j\omega)| < 1/|W_2(j\omega)|, \quad \forall\omega\\
& |H_3(j\omega)| < 1/|W_3(j\omega)|, \quad \forall\omega\\
& H_1(s) + H_2(s) + H_3(s) = 1
\end{align*}
<p>
For that, we use the \(\mathcal{H}_\infty\) synthesis with the architecture shown on figure <a href="#orgae29348">11</a>.
</p>
<div id="orgae29348" class="figure">
<p><img src="figs-journal/comp_filter_three_hinf_fb.png" alt="comp_filter_three_hinf_fb.png" />
</p>
<p><span class="figure-number">Figure 11: </span>Generalized architecture for generating 3 complementary filters</p>
</div>
<p>
The \(\mathcal{H}_\infty\) objective is:
</p>
\begin{align*}
& |(1 - H_2(j\omega) - H_3(j\omega)) W_1(j\omega)| < 1, \quad \forall\omega\\
& |H_2(j\omega) W_2(j\omega)| < 1, \quad \forall\omega\\
& |H_3(j\omega) W_3(j\omega)| < 1, \quad \forall\omega\\
\end{align*}
<p>
And thus if we choose \(H_1 = 1 - H_2 - H_3\) we have solved the problem.
</p>
</div>
</div>
<div id="outline-container-orga0b98b5" class="outline-3">
<h3 id="orga0b98b5"><span class="section-number-3">4.2.</span> Weights</h3>
<div class="outline-text-3" id="text-4-2">
<p>
First we define the weights.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Design of the Weighting Functions</span>
W1 = generateWF(<span class="org-string">'n'</span>, 2, <span class="org-string">'w0'</span>, 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>1, <span class="org-string">'G0'</span>, 1<span class="org-builtin">/</span>10, <span class="org-string">'Ginf'</span>, 1000, <span class="org-string">'Gc'</span>, 0.5);
W2 = 0.22<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>1)<span class="org-builtin">^</span>2<span class="org-builtin">/</span>(sqrt(1e<span class="org-builtin">-</span>4) <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>1)<span class="org-builtin">^</span>2<span class="org-builtin">*</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>10)<span class="org-builtin">^</span>2<span class="org-builtin">/</span>(1 <span class="org-builtin">+</span> s<span class="org-builtin">/</span>2<span class="org-builtin">/</span><span class="org-matlab-math">pi</span><span class="org-builtin">/</span>1000)<span class="org-builtin">^</span>2;
W3 = generateWF(<span class="org-string">'n'</span>, 3, <span class="org-string">'w0'</span>, 2<span class="org-builtin">*</span><span class="org-matlab-math">pi</span><span class="org-builtin">*</span>10, <span class="org-string">'G0'</span>, 1000, <span class="org-string">'Ginf'</span>, 1<span class="org-builtin">/</span>10, <span class="org-string">'Gc'</span>, 0.5);
</pre>
</div>
<div id="org3226eb7" class="figure">
<p><img src="figs/three_weighting_functions.png" alt="three_weighting_functions.png" />
</p>
<p><span class="figure-number">Figure 12: </span>Three weighting functions used for the \(\mathcal{H}_\infty\) synthesis of the complementary filters</p>
</div>
</div>
</div>
<div id="outline-container-orgc61bfb8" class="outline-3">
<h3 id="orgc61bfb8"><span class="section-number-3">4.3.</span> H-Infinity Synthesis</h3>
<div class="outline-text-3" id="text-4-3">
<p>
Then we create the generalized plant <code>P</code>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Generalized plant for the synthesis of 3 complementary filters</span>
P = [W1 <span class="org-builtin">-</span>W1 <span class="org-builtin">-</span>W1;
0 W2 0 ;
0 0 W3;
1 0 0];
</pre>
</div>
<p>
And we do the \(\mathcal{H}_\infty\) synthesis.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Standard H-Infinity Synthesis</span>
[H, <span class="org-builtin">~</span>, gamma, <span class="org-builtin">~</span>] = hinfsyn(P, 1, 2,<span class="org-string">'TOLGAM'</span>, 0.001, <span class="org-string">'METHOD'</span>, <span class="org-string">'ric'</span>, <span class="org-string">'DISPLAY'</span>, <span class="org-string">'on'</span>);
</pre>
</div>
<pre class="example" id="org249047c">
[H, ~, gamma, ~] = hinfsyn(P, 1, 2,'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;= 1050.0000
gamma hamx_eig xinf_eig hamy_eig yinf_eig nrho_xy p/f
1.050e+03 3.2e+00 4.5e-13 6.3e-02 -1.2e-11 0.0000 p
525.050 3.2e+00 1.3e-13 6.3e-02 0.0e+00 0.0000 p
262.575 3.2e+00 2.1e-12 6.3e-02 -1.5e-13 0.0000 p
131.337 3.2e+00 1.1e-12 6.3e-02 -7.2e-29 0.0000 p
65.719 3.2e+00 2.0e-12 6.3e-02 0.0e+00 0.0000 p
32.909 3.2e+00 7.4e-13 6.3e-02 -5.9e-13 0.0000 p
16.505 3.2e+00 1.4e-12 6.3e-02 0.0e+00 0.0000 p
8.302 3.2e+00 1.6e-12 6.3e-02 0.0e+00 0.0000 p
4.201 3.2e+00 1.6e-12 6.3e-02 0.0e+00 0.0000 p
2.151 3.2e+00 1.6e-12 6.3e-02 0.0e+00 0.0000 p
1.125 3.2e+00 2.8e-12 6.3e-02 0.0e+00 0.0000 p
0.613 3.0e+00 -2.5e+03# 6.3e-02 0.0e+00 0.0000 f
0.869 3.1e+00 -2.9e+01# 6.3e-02 0.0e+00 0.0000 f
0.997 3.2e+00 1.9e-12 6.3e-02 0.0e+00 0.0000 p
0.933 3.1e+00 -6.9e+02# 6.3e-02 0.0e+00 0.0000 f
0.965 3.1e+00 -3.0e+03# 6.3e-02 0.0e+00 0.0000 f
0.981 3.1e+00 -8.6e+03# 6.3e-02 0.0e+00 0.0000 f
0.989 3.2e+00 -2.7e+04# 6.3e-02 0.0e+00 0.0000 f
0.993 3.2e+00 -5.7e+05# 6.3e-02 0.0e+00 0.0000 f
0.995 3.2e+00 2.2e-12 6.3e-02 0.0e+00 0.0000 p
0.994 3.2e+00 1.6e-12 6.3e-02 0.0e+00 0.0000 p
0.994 3.2e+00 1.0e-12 6.3e-02 0.0e+00 0.0000 p
Gamma value achieved: 0.9936
</pre>
</div>
</div>
<div id="outline-container-org1db94f4" class="outline-3">
<h3 id="org1db94f4"><span class="section-number-3">4.4.</span> Obtained Complementary Filters</h3>
<div class="outline-text-3" id="text-4-4">
<p>
The obtained filters are:
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%%</span>
H2 = tf(H(1));
H3 = tf(H(2));
H1 = 1 <span class="org-builtin">-</span> H2 <span class="org-builtin">-</span> H3;
</pre>
</div>
<div id="org35debfb" class="figure">
<p><img src="figs/three_complementary_filters_results.png" alt="three_complementary_filters_results.png" />
</p>
<p><span class="figure-number">Figure 13: </span>The three complementary filters obtained after \(\mathcal{H}_\infty\) synthesis</p>
</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 id="citeproc_bib_item_1"></a>Dehaeze, Thomas, Mohit Vermat, and Christophe Collette. 2021. “A New Method of Designing Complementary Filters for Sensor Fusion Using the $H_\Infty$ Synthesis.” <i>Mechanical Systems and Signal Processing</i>, November.</div>
<div class="csl-entry"><a id="citeproc_bib_item_2"></a>Hua, Wensheng. 2005. “Low Frequency Vibration Isolation and Alignment System for Advanced LIGO.” stanford university.</div>
</div>
<div id="outline-container-sec:functions" class="outline-2">
<h2 id="sec:functions"><span class="section-number-2">5.</span> Functions</h2>
<div class="outline-text-2" id="text-sec:functions">
</div>
<div id="outline-container-org45afa96" class="outline-3">
<h3 id="org45afa96"><span class="section-number-3">5.1.</span> <code>generateWF</code>: Generate Weighting Functions</h3>
<div class="outline-text-3" id="text-5-1">
<p>
<a id="org44ce613"></a>
</p>
<p>
This Matlab function is accessible <a href="matlab/src/generateWF.m">here</a>.
</p>
</div>
<div id="outline-container-orgd2a9c04" class="outline-4">
<h4 id="orgd2a9c04">Function description</h4>
<div class="outline-text-4" id="text-orgd2a9c04">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[W]</span> = <span class="org-function-name">generateWF</span>(<span class="org-variable-name">args</span>)
<span class="org-comment-delimiter">% </span><span class="org-comment">createWeight -</span>
<span class="org-comment">%</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Syntax: [W] = generateWeight(args)</span>
<span class="org-comment">%</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Inputs:</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- n - Weight Order (integer)</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- G0 - Low frequency Gain</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- G1 - High frequency Gain</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- Gc - Gain of the weight at frequency w0</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- w0 - Frequency at which |W(j w0)| = Gc [rad/s]</span>
<span class="org-comment">%</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Outputs:</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- W - Generated Weighting Function</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org603cf67" class="outline-4">
<h4 id="org603cf67">Optional Parameters</h4>
<div class="outline-text-4" id="text-org603cf67">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Argument validation</span>
arguments
args.n (1,1) double {mustBeInteger, mustBePositive} = 1
args.G0 (1,1) double {mustBeNumeric, mustBePositive} = 0.1
args.Ginf (1,1) double {mustBeNumeric, mustBePositive} = 10
args.Gc (1,1) double {mustBeNumeric, mustBePositive} = 1
args.w0 (1,1) double {mustBeNumeric, mustBePositive} = 1
<span class="org-keyword">end</span>
</pre>
</div>
<p>
Verification that the parameters \(G_0\), \(G_c\) and \(G_\infty\) are satisfy condition \eqref{eq:cond_formula_1} or \eqref{eq:cond_formula_2}.
</p>
\begin{equation}
G_0 < 1 < G_\infty \text{ and } G_0 < G_c < G_\infty \label{eq:cond_formula_1}
\end{equation}
\begin{equation}
G_\infty < 1 < G_0 \text{ and } G_\infty < G_c < G_0 \label{eq:cond_formula_2}
\end{equation}
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-comment-delimiter">% </span><span class="org-comment">Verification of correct relation between G0, Gc and Ginf</span>
mustBeBetween(args.G0, args.Gc, args.Ginf);
</pre>
</div>
</div>
</div>
<div id="outline-container-org01be6d3" class="outline-4">
<h4 id="org01be6d3">Generate the Weighting function</h4>
<div class="outline-text-4" id="text-org01be6d3">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Initialize the Laplace variable</span>
s = zpk(<span class="org-string">'s'</span>);
</pre>
</div>
<p>
The weighting function formula use is:
</p>
\begin{equation}
\label{orge02c446}
W(s) = \left( \frac{
\frac{1}{\omega_c} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{G_0}{G_c}\right)^{\frac{1}{n}}
}{
\left(\frac{1}{G_\infty}\right)^{\frac{1}{n}} \frac{1}{\omega_c} \sqrt{\frac{1 - \left(\frac{G_0}{G_c}\right)^{\frac{2}{n}}}{1 - \left(\frac{G_c}{G_\infty}\right)^{\frac{2}{n}}}} s + \left(\frac{1}{G_c}\right)^{\frac{1}{n}}
}\right)^n
\end{equation}
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Create the weighting function according to formula</span>
W = (((1<span class="org-builtin">/</span>args.w0)<span class="org-builtin">*</span>sqrt((1<span class="org-builtin">-</span>(args.G0<span class="org-builtin">/</span>args.Gc)<span class="org-builtin">^</span>(2<span class="org-builtin">/</span>args.n))<span class="org-builtin">/</span>(1<span class="org-builtin">-</span>(args.Gc<span class="org-builtin">/</span>args.Ginf)<span class="org-builtin">^</span>(2<span class="org-builtin">/</span>args.n)))<span class="org-builtin">*</span>s <span class="org-builtin">+</span> <span class="org-comment">...</span>
(args.G0<span class="org-builtin">/</span>args.Gc)<span class="org-builtin">^</span>(1<span class="org-builtin">/</span>args.n))<span class="org-builtin">/</span><span class="org-comment">...</span>
((1<span class="org-builtin">/</span>args.Ginf)<span class="org-builtin">^</span>(1<span class="org-builtin">/</span>args.n)<span class="org-builtin">*</span>(1<span class="org-builtin">/</span>args.w0)<span class="org-builtin">*</span>sqrt((1<span class="org-builtin">-</span>(args.G0<span class="org-builtin">/</span>args.Gc)<span class="org-builtin">^</span>(2<span class="org-builtin">/</span>args.n))<span class="org-builtin">/</span>(1<span class="org-builtin">-</span>(args.Gc<span class="org-builtin">/</span>args.Ginf)<span class="org-builtin">^</span>(2<span class="org-builtin">/</span>args.n)))<span class="org-builtin">*</span>s <span class="org-builtin">+</span> <span class="org-comment">...</span>
(1<span class="org-builtin">/</span>args.Gc)<span class="org-builtin">^</span>(1<span class="org-builtin">/</span>args.n)))<span class="org-builtin">^</span>args.n;
</pre>
</div>
</div>
</div>
<div id="outline-container-org61ff351" class="outline-4">
<h4 id="org61ff351">Verification of the \(G_0\), \(G_c\) and \(G_\infty\) gains</h4>
<div class="outline-text-4" id="text-org61ff351">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Custom validation function</span>
<span class="org-keyword">function</span> <span class="org-function-name">mustBeBetween</span>(<span class="org-variable-name">a</span>,<span class="org-variable-name">b</span>,<span class="org-variable-name">c</span>)
<span class="org-keyword">if</span> <span class="org-builtin">~</span>((a <span class="org-builtin">&gt;</span> b <span class="org-builtin">&amp;&amp;</span> b <span class="org-builtin">&gt;</span> c) <span class="org-builtin">||</span> (c <span class="org-builtin">&gt;</span> b <span class="org-builtin">&amp;&amp;</span> b <span class="org-builtin">&gt;</span> a))
eid = <span class="org-string">'createWeight:inputError'</span>;
msg = <span class="org-string">'Gc should be between G0 and Ginf.'</span>;
throwAsCaller(MException(eid,msg))
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orga2379de" class="outline-3">
<h3 id="orga2379de"><span class="section-number-3">5.2.</span> <code>generateCF</code>: Generate Complementary Filters</h3>
<div class="outline-text-3" id="text-5-2">
<p>
<a id="org7bd2b8a"></a>
</p>
<p>
This Matlab function is accessible <a href="matlab/src/generateCF.m">here</a>.
</p>
</div>
<div id="outline-container-org9330a28" class="outline-4">
<h4 id="org9330a28">Function description</h4>
<div class="outline-text-4" id="text-org9330a28">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-keyword">function</span> <span class="org-variable-name">[H1, H2]</span> = <span class="org-function-name">generateCF</span>(<span class="org-variable-name">W1</span>, <span class="org-variable-name">W2</span>, <span class="org-variable-name">args</span>)
<span class="org-comment-delimiter">% </span><span class="org-comment">createWeight -</span>
<span class="org-comment">%</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Syntax: [H1, H2] = generateCF(W1, W2, args)</span>
<span class="org-comment">%</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Inputs:</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- W1 - Weighting Function for H1</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- W2 - Weighting Function for H2</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- args:</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- method - H-Infinity solver ('lmi' or 'ric')</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- display - Display synthesis results ('on' or 'off')</span>
<span class="org-comment">%</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">Outputs:</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- H1 - Generated H1 Filter</span>
<span class="org-comment-delimiter">% </span><span class="org-comment">- H2 - Generated H2 Filter</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org273e9cb" class="outline-4">
<h4 id="org273e9cb">Optional Parameters</h4>
<div class="outline-text-4" id="text-org273e9cb">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% Argument validation</span>
arguments
W1
W2
args.method char {mustBeMember(args.method,{<span class="org-string">'lmi'</span>, <span class="org-string">'ric'</span>})} = <span class="org-string">'ric'</span>
args.display char {mustBeMember(args.display,{<span class="org-string">'on'</span>, <span class="org-string">'off'</span>})} = <span class="org-string">'on'</span>
<span class="org-keyword">end</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org13f31c2" class="outline-4">
<h4 id="org13f31c2">H-Infinity Synthesis</h4>
<div class="outline-text-4" id="text-org13f31c2">
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% The generalized plant is defined</span>
P = [W1 <span class="org-builtin">-</span>W1;
0 W2;
1 0];
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% The standard H-infinity synthesis is performed</span>
[H2, <span class="org-builtin">~</span>, gamma, <span class="org-builtin">~</span>] = hinfsyn(P, 1, 1,<span class="org-string">'TOLGAM'</span>, 0.001, <span class="org-string">'METHOD'</span>, args.method, <span class="org-string">'DISPLAY'</span>, args.display);
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span class="org-matlab-cellbreak">%% H1 is defined as the complementary of H2</span>
H1 = 1 <span class="org-builtin">-</span> H2;
</pre>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2021-09-01 mer. 11:26</p>
</div>
</body>
</html>