Compare commits

...

3 Commits

Author SHA1 Message Date
eb57832eb7 Rename main orgmode matlab file 2021-09-01 09:56:37 +02:00
84b224ce38 Rework abstract 2021-09-01 09:56:26 +02:00
e82e86486e Rework matlab functions 2021-09-01 09:56:11 +02:00
5 changed files with 163 additions and 68 deletions

View File

@ -1,4 +1,4 @@
% Created 2021-08-31 mar. 14:16
% Created 2021-08-31 mar. 14:07
% Intended LaTeX compiler: pdflatex
\documentclass[preprint, sort&compress]{elsarticle}
\usepackage[utf8]{inputenc}
@ -43,13 +43,12 @@
\begin{frontmatter}
\begin{abstract}
In order to obtain a better estimate of a quantity being measured, several sensors having different characteristics can be merged with a technique called ``sensor fusion''.
The obtained ``super sensor'' can combine the benefits of the individual sensors provided that the complementary filters used in the fusion are well designed.
Indeed, properties of the super sensor are linked to the magnitude of the complementary filters.
Properly shaping the magnitude of complementary filters is a difficult and time-consuming task.
The obtained ``super sensor'' can combine the benefits of the individual sensors provided that the magnitude of the complementary filters used in the fusion are well shaped.
Properly designing complementary filters is a difficult and time-consuming task.
In this study, we address this issue and propose a new method for designing complementary filters.
This method uses weighting functions to specify the wanted shape of the complementary filter that are then easily obtained using the standard \(\mathcal{H}_\infty\) synthesis.
This method uses weighting functions to specify the wanted shape of the complementary filter that are then easily obtained using the standard \(\mathcal{H}_\infty\) synthesis on a specific generalized plant.
The proper choice of the weighting functions is discussed, and the effectiveness and simplicity of the design method is highlighted using several examples.
Such synthesis method is further extended for the shaping of more than two complementary filters.
Such synthesis method is further generalized to a set of more than two complementary filters.
\end{abstract}
\begin{keyword}
@ -58,7 +57,7 @@ Sensor fusion \sep{} Complementary filters \sep{} \(\mathcal{H}_\infty\) synthes
\end{frontmatter}
\section{Introduction}
\label{sec:orgb3159e9}
\label{sec:org45b63f3}
\label{sec:introduction}
Measuring a physical quantity using sensors is always subject to several limitations.
First, the accuracy of the measurement will be affected by several noise sources, such as the electrical noise of the conditioning electronics being used.
@ -105,13 +104,13 @@ The synthesis method is further validated in Section~\ref{sec:application_ligo}
Section~\ref{sec:discussion} compares the proposed synthesis method with the classical mixed-sensitivity synthesis, and extends it to the shaping of more than two complementary filters.
\section{Sensor Fusion and Complementary Filters Requirements}
\label{sec:orge37bf43}
\label{sec:orgeeb9584}
\label{sec:requirements}
Complementary filters provides a framework for fusing signals from different sensors.
As the effectiveness of the fusion depends on the proper design of the complementary filters, they are expected to fulfill certain requirements.
These requirements are discussed in this section.
\subsection{Sensor Fusion Architecture}
\label{sec:orgd0086e9}
\label{sec:org556a17c}
\label{sec:sensor_fusion}
A general sensor fusion architecture using complementary filters is shown in Fig.~\ref{fig:sensor_fusion_overview} where several sensors (here two) are measuring the same physical quantity \(x\).
@ -138,7 +137,7 @@ Therefore, a pair of complementary filter needs to satisfy the following conditi
It will soon become clear why the complementary property is important for the sensor fusion architecture.
\subsection{Sensor Models and Sensor Normalization}
\label{sec:orgf4072c3}
\label{sec:org5c5b6fb}
\label{sec:sensor_models}
In order to study such sensor fusion architecture, a model for the sensors is required.
@ -184,7 +183,7 @@ The super sensor output is therefore equal to:
\end{figure}
\subsection{Noise Sensor Filtering}
\label{sec:org72d0e25}
\label{sec:org4d93421}
\label{sec:noise_filtering}
In this section, it is supposed that all the sensors are perfectly normalized, such that:
@ -225,7 +224,7 @@ In such case, to lower the noise of the super sensor, the norm \(|H_1(j\omega)|\
Therefore, by properly shaping the norm of the complementary filters, it is possible to minimize the noise of the super sensor noise.
\subsection{Sensor Fusion Robustness}
\label{sec:org6b3c1f3}
\label{sec:org0ab9090}
\label{sec:fusion_robustness}
In practical systems the sensor normalization is not perfect and condition \eqref{eq:perfect_dynamics} is not verified.
@ -289,7 +288,7 @@ As it is generally desired to limit the maximum phase added by the super sensor,
Typically, the norm of the complementary filter \(|H_i(j\omega)|\) should be made small when \(|w_i(j\omega)|\) is large, i.e., at frequencies where the sensor dynamics is uncertain.
\section{Complementary Filters Shaping}
\label{sec:org25756ab}
\label{sec:orgdf903f0}
\label{sec:hinf_method}
As shown in Section~\ref{sec:requirements}, the noise and robustness of the super sensor are a function of the complementary filters norms.
Therefore, a complementary filters synthesis method that allows to shape their norms would be of great use.
@ -297,7 +296,7 @@ In this section, such synthesis is proposed by writing the synthesis objective a
As weighting functions are used to represent the wanted complementary filters shapes during the synthesis, the proper design of weighting functions is discussed.
Finally, the synthesis method is validated on an simple example.
\subsection{Synthesis Objective}
\label{sec:org6c44b50}
\label{sec:org2467206}
\label{sec:synthesis_objective}
The synthesis objective is to shape the norm of two filters \(H_1(s)\) and \(H_2(s)\) while ensuring their complementary property \eqref{eq:comp_filter}.
@ -314,7 +313,7 @@ This is equivalent as to finding proper and stable transfer functions \(H_1(s)\)
\(W_1(s)\) and \(W_2(s)\) are two weighting transfer functions that are carefully chosen to specify the maximum wanted norms of the complementary filters during the synthesis.
\subsection{Shaping of Complementary Filters using \(\mathcal{H}_\infty\) synthesis}
\label{sec:org1538346}
\label{sec:org172468e}
\label{sec:hinf_synthesis}
In this section, it is shown that the synthesis objective can be easily expressed as a standard \(\mathcal{H}_\infty\) optimization problem and therefore solved using convenient tools readily available.
@ -370,7 +369,7 @@ There might be solutions were the objectives~\eqref{eq:hinf_cond_h1} and~\eqref{
In practice, this is however not an found to be an issue.
\subsection{Weighting Functions Design}
\label{sec:org11b4246}
\label{sec:org3b7e958}
\label{sec:hinf_weighting_func}
Weighting functions are used during the synthesis to specify the maximum allowed norms of the complementary filters.
@ -419,7 +418,7 @@ An example of the obtained magnitude of a weighting function generated using \eq
\end{figure}
\subsection{Validation of the proposed synthesis method}
\label{sec:orgb9a4dc3}
\label{sec:org13db233}
\label{sec:hinf_example}
The proposed methodology for the design of complementary filters is now applied on a simple example where two complementary filters \(H_1(s)\) and \(H_2(s)\) have to be designed such that:
@ -490,7 +489,7 @@ This simple example illustrates the fact that the proposed methodology for compl
A more complex real life example is taken up in the next section.
\section{Application: Design of Complementary Filters used in the Active Vibration Isolation System at the LIGO}
\label{sec:org157e8c9}
\label{sec:orgb11268e}
\label{sec:application_ligo}
Sensor fusion using complementary filters are widely used in active vibration isolation systems in gravitational wave detectors such at the LIGO~\cite{matichard15_seism_isolat_advan_ligo,hua05_low_ligo}, the VIRGO~\cite{lucia18_low_frequen_optim_perfor_advan,heijningen18_low} and the KAGRA \cite[Chap. 5]{sekiguchi16_study_low_frequen_vibrat_isolat_system}.
@ -513,7 +512,7 @@ After synthesis, the obtained FIR filters were found to be compliant with the re
However they are of very high order so their implementation is quite complex.
In this section, the effectiveness of the proposed complementary filter synthesis strategy is demonstrated on the same set of requirements.
\subsection{Complementary Filters Specifications}
\label{sec:org872bc34}
\label{sec:org100bb02}
\label{sec:ligo_specifications}
The specifications for the set of complementary filters (\(L_1,H_1\)) used at the LIGO are summarized below (for further details, refer to~\cite{hua04_polyp_fir_compl_filter_contr_system}):
@ -534,7 +533,7 @@ They are physically represented in Fig.~\ref{fig:fir_filter_ligo} as well as the
\end{figure}
\subsection{Weighting Functions Design}
\label{sec:org97ac8c9}
\label{sec:orgba233a6}
\label{sec:ligo_weights}
The weighting functions should be designed such that their inverse magnitude is as close as possible to the specifications in order to not over-constrain the synthesis problem.
@ -551,7 +550,7 @@ The magnitudes of the weighting functions are shown in Fig.~\ref{fig:ligo_weight
\end{figure}
\subsection{\(\mathcal{H}_\infty\) Synthesis of the complementary filters}
\label{sec:orgf148a21}
\label{sec:org705f5c2}
\label{sec:ligo_results}
The proposed \(\mathcal{H}_\infty\) synthesis is performed on the generalized plant shown in Fig.~\ref{fig:h_infinity_robust_fusion_plant}.
@ -567,10 +566,10 @@ This confirms the effectiveness of the proposed synthesis method even when the c
\end{figure}
\section{Discussion}
\label{sec:orgbc3d67c}
\label{sec:org2d41692}
\label{sec:discussion}
\subsection{``Closed-Loop'' complementary filters}
\label{sec:org84a8225}
\label{sec:org2106ef4}
\label{sec:closed_loop_complementary_filters}
An alternative way to implement complementary filters is by using a fundamental property of the classical feedback architecture shown in Fig.~\ref{fig:feedback_sensor_fusion}.
This is for instance presented in \cite{mahony05_compl_filter_desig_special_orthog,plummer06_optim_compl_filter_their_applic_motion_measur,jensen13_basic_uas}.
@ -667,7 +666,7 @@ The obtained ``closed-loop'' complementary filters are indeed equal to the ones
\end{figure}
\subsection{Synthesis of more than two Complementary Filters}
\label{sec:org862b3a1}
\label{sec:org5b39592}
\label{sec:hinf_three_comp_filters}
Some applications may require to merge more than two sensors~\cite{stoten01_fusion_kinet_data_using_compos_filter,becker15_compl_filter_desig_three_frequen_bands}.
@ -771,7 +770,7 @@ A set of \(n\) complementary filters can be shaped using the generalized plant \
\end{equation}
\section{Conclusion}
\label{sec:org35fb45f}
\label{sec:org369c466}
\label{sec:conclusion}
Sensors measuring a physical quantities are always subject to limitations both in terms of bandwidth or accuracy.
@ -785,12 +784,12 @@ Links with ``closed-loop'' complementary filters where highlighted, and the prop
Future work will aim at developing a complementary filter synthesis method that minimizes the super sensor noise while ensuring the robustness of the fusion.
\section*{Acknowledgment}
\label{sec:org7a5f4b3}
\label{sec:orgd71260d}
This research benefited from a FRIA grant from the French Community of Belgium.
This paper is based on a paper previously presented at the ICCMA conference~\cite{dehaeze19_compl_filter_shapin_using_synth}.
\section*{Data Availability}
\label{sec:org767c106}
\label{sec:org30a4627}
Matlab \cite{matlab20} was used for this study.
The source code is available under a MIT License and archived in Zenodo~\cite{dehaeze21_new_method_desig_compl_filter_code}.

View File

@ -1,4 +1,4 @@
#+TITLE: Complementary Filters Shaping Using $\mathcal{H}_\infty$ Synthesis - Matlab Computation
#+TITLE: A new method of designing complementary filters for sensor fusion using the $\mathcal{H}_\infty$ synthesis - Matlab Computation
:DRAWER:
#+HTML_LINK_HOME: ../index.html
#+HTML_LINK_UP: ../index.html
@ -34,23 +34,12 @@
:END:
* Introduction :ignore:
In this document, the design of complementary filters is studied.
One use of complementary filter is described below:
#+begin_quote
The basic idea of a complementary filter involves taking two or more sensors, filtering out unreliable frequencies for each sensor, and combining the filtered outputs to get a better estimate throughout the entire bandwidth of the system.
To achieve this, the sensors included in the filter should complement one another by performing better over specific parts of the system bandwidth.
#+end_quote
This document is divided into several sections:
- in section [[#sec:h_inf_synthesis_complementary_filters]], the $\mathcal{H}_\infty$ synthesis is used for generating two complementary filters
- in section [[sec:three_comp_filters]], a method using the $\mathcal{H}_\infty$ synthesis is proposed to shape three of more complementary filters
- in section [[sec:comp_filters_ligo]], the $\mathcal{H}_\infty$ synthesis is used and compared with FIR complementary filters used for LIGO
#+begin_note
Add the Matlab code use to obtain the results presented in the paper are accessible [[file:matlab.zip][here]] and presented below.
#+end_note
* H-Infinity synthesis of complementary filters
:PROPERTIES:
:header-args:matlab+: :tangle matlab/h_inf_synthesis_complementary_filters.m
@ -155,6 +144,7 @@ xlabel('Frequency [Hz]'); ylabel('Magnitude');
hold off;
xlim([freqs(1), freqs(end)]);
ylim([5e-4, 20]);
yticks([1e-4, 1e-3, 1e-2, 1e-1, 1, 1e1]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
@ -176,23 +166,28 @@ W2 = (((1/w0)*sqrt((1-(G0/Gc)^(2/n))/(1-(Gc/G1)^(2/n)))*s + (G0/Gc)^(1/n))/((1/G
#+begin_src matlab :exports none
figure;
tiledlayout(1, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile();
hold on;
set(gca,'ColorOrderIndex',1)
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$|W_1|^{-1}$');
set(gca,'ColorOrderIndex',2)
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$|W_2|^{-1}$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Magnitude');
xlabel('Frequency [Hz]', 'FontSize', 10); ylabel('Magnitude', 'FontSize', 10);
hold off;
xlim([freqs(1), freqs(end)]);
ylim([1e-4, 20]);
xticks([0.1, 1, 10, 100, 1000]);
leg = legend('location', 'southeast', 'FontSize', 8);
ylim([8e-4, 20]);
yticks([1e-3, 1e-2, 1e-1, 1, 1e1]);
yticklabels({'', '$10^{-2}$', '', '$10^0$', ''});
ax1.FontSize = 9;
leg = legend('location', 'south', 'FontSize', 8);
leg.ItemTokenSize(1) = 18;
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/weights_W1_W2.pdf', 'width', 'wide', 'height', 'normal');
exportFig('figs/weights_W1_W2.pdf', 'width', 'half', 'height', 350);
#+end_src
#+name: fig:weights_W1_W2
@ -279,22 +274,21 @@ tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
ax1 = nexttile([2, 1]);
hold on;
set(gca,'ColorOrderIndex',1)
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$w_1$');
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$|W_1|^{-1}$');
set(gca,'ColorOrderIndex',2)
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$w_2$');
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$|W_2|^{-1}$');
set(gca,'ColorOrderIndex',1)
plot(freqs, abs(squeeze(freqresp(H1, freqs, 'Hz'))), '-', 'DisplayName', '$H_1$');
set(gca,'ColorOrderIndex',2)
plot(freqs, abs(squeeze(freqresp(H2, freqs, 'Hz'))), '-', 'DisplayName', '$H_2$');
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
ylabel('Magnitude');
set(gca, 'XTickLabel',[]);
ylim([1e-4, 20]);
yticks([1e-4, 1e-3, 1e-2, 1e-1, 1, 1e1]);
leg = legend('location', 'southeast', 'FontSize', 8, 'NumColumns', 2);
set(gca, 'XTickLabel',[]); ylabel('Magnitude');
ylim([8e-4, 20]);
yticks([1e-3, 1e-2, 1e-1, 1, 1e1]);
yticklabels({'', '$10^{-2}$', '', '$10^0$', ''})
leg = legend('location', 'south', 'FontSize', 8, 'NumColumns', 2);
leg.ItemTokenSize(1) = 18;
% Phase
@ -305,16 +299,18 @@ plot(freqs, 180/pi*phase(squeeze(freqresp(H1, freqs, 'Hz'))), '-');
set(gca,'ColorOrderIndex',2)
plot(freqs, 180/pi*phase(squeeze(freqresp(H2, freqs, 'Hz'))), '-');
hold off;
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
set(gca, 'XScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
yticks([-180:90:180]);
ylim([-180, 200])
yticklabels({'-180', '', '0', '', '180'})
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/hinf_filters_results.pdf', 'width', 'wide', 'height', 600);
exportFig('figs/hinf_filters_results.pdf', 'width', 700, 'height', 450);
#+end_src
#+name: fig:hinf_filters_results
@ -1352,7 +1348,7 @@ P = [ W1 0 1;
#+end_src
#+begin_src matlab :results output replace :exports both
[L, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'lmi', 'DISPLAY', 'on');
[L, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', 'ric', 'DISPLAY', 'on');
#+end_src
#+begin_src matlab
@ -1368,20 +1364,80 @@ zpk(H2)
#+RESULTS:
#+begin_example
zpk(H1)
ans =
(s+2.115e07) (s+153.6) (s+4.613) (s^2 + 6.858s + 12.03)
--------------------------------------------------------
(s+2.117e07) (s^2 + 102.1s + 2732) (s^2 + 69.43s + 3271)
(s+3.842)^3 (s+153.6) (s+1.289e05)
-------------------------------------------------------
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
Continuous-time zero/pole/gain model.
zpk(H2)
ans =
20455 (s+3425) (s+3318) (s^2 + 46.58s + 813.2)
--------------------------------------------------------
(s+2.117e07) (s^2 + 102.1s + 2732) (s^2 + 69.43s + 3271)
125.61 (s+3358)^2 (s^2 + 46.61s + 813.8)
-------------------------------------------------------
(s+1.29e05) (s^2 + 102.1s + 2733) (s^2 + 69.45s + 3272)
Continuous-time zero/pole/gain model.
#+end_example
#+begin_src matlab :exports none
freqs = logspace(-1, 3, 1000);
figure;
tiledlayout(3, 1, 'TileSpacing', 'None', 'Padding', 'None');
% Magnitude
ax1 = nexttile([2, 1]);
hold on;
set(gca,'ColorOrderIndex',1)
plot(freqs, 1./abs(squeeze(freqresp(W1, freqs, 'Hz'))), '--', 'DisplayName', '$|W_1|^{-1}$');
set(gca,'ColorOrderIndex',2)
plot(freqs, 1./abs(squeeze(freqresp(W2, freqs, 'Hz'))), '--', 'DisplayName', '$|W_2|^{-1}$');
set(gca,'ColorOrderIndex',1)
plot(freqs, abs(squeeze(freqresp(H1, freqs, 'Hz'))), '-', 'DisplayName', '$H_1$');
set(gca,'ColorOrderIndex',2)
plot(freqs, abs(squeeze(freqresp(H2, freqs, 'Hz'))), '-', 'DisplayName', '$H_2$');
plot(freqs, abs(squeeze(freqresp(L, freqs, 'Hz'))), 'k--', 'DisplayName', '$|L|$');
hold off;
set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log');
set(gca, 'XTickLabel',[]); ylabel('Magnitude');
ylim([1e-3, 1e3]);
yticks([1e-3, 1e-2, 1e-1, 1, 1e1, 1e2, 1e3]);
yticklabels({'', '$10^{-2}$', '', '$10^0$', '', '$10^2$', ''});
leg = legend('location', 'northeast', 'FontSize', 8, 'NumColumns', 3);
leg.ItemTokenSize(1) = 18;
% Phase
ax2 = nexttile;
hold on;
set(gca,'ColorOrderIndex',1)
plot(freqs, 180/pi*phase(squeeze(freqresp(H1, freqs, 'Hz'))), '-');
set(gca,'ColorOrderIndex',2)
plot(freqs, 180/pi*phase(squeeze(freqresp(H2, freqs, 'Hz'))), '-');
hold off;
set(gca, 'XScale', 'log');
xlabel('Frequency [Hz]'); ylabel('Phase [deg]');
yticks([-180:90:180]);
ylim([-180, 200])
yticklabels({'-180', '', '0', '', '180'})
linkaxes([ax1,ax2],'x');
xlim([freqs(1), freqs(end)]);
#+end_src
#+begin_src matlab :tangle no :exports results :results file replace
exportFig('figs/hinf_filters_results_mixed_sensitivity.pdf', 'width', 700 , 'height', 600);
#+end_src
#+name: fig:hinf_filters_results_mixed_sensitivity
#+caption:
#+RESULTS:
[[file:figs/hinf_filters_results_mixed_sensitivity.png]]
#+begin_src matlab :exports none
freqs = logspace(-2, 4, 1000);
@ -2592,10 +2648,14 @@ bibliographystyle:unsrt
bibliography:ref.bib
* Functions
:PROPERTIES:
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:functions>>
** =generateWF=: Generate Weighting Functions
:PROPERTIES:
:header-args:matlab+: :tangle matlab/src/generateWF.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:generateWF>>
@ -2620,7 +2680,7 @@ function [W] = generateWF(args)
% - w0 - Frequency at which |W(j w0)| = Gc [rad/s]
%
% Outputs:
% - W - Generated Weight
% - W - Generated Weighting Function
#+end_src
*** Optional Parameters
@ -2628,6 +2688,7 @@ function [W] = generateWF(args)
:UNNUMBERED: t
:END:
#+begin_src matlab
%% Argument validation
arguments
args.n (1,1) double {mustBeInteger, mustBePositive} = 1
args.G0 (1,1) double {mustBeNumeric, mustBePositive} = 0.1
@ -2635,7 +2696,19 @@ arguments
args.Gc (1,1) double {mustBeNumeric, mustBePositive} = 1
args.w0 (1,1) double {mustBeNumeric, mustBePositive} = 1
end
#+end_src
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.
#+name: eq:condition_params_formula
\begin{subequations}
\begin{align}
G_0 < 1 < G_\infty \text{ and } G_0 < G_c < G_\infty \label{eq:cond_formula_1}\\
G_\infty < 1 < G_0 \text{ and } G_\infty < G_c < G_0 \label{eq:cond_formula_2}
\end{align}
\end{subequations}
#+begin_src matlab
% Verification of correct relation between G0, Gc and Ginf
mustBeBetween(args.G0, args.Gc, args.Ginf);
#+end_src
@ -2644,10 +2717,22 @@ mustBeBetween(args.G0, args.Gc, args.Ginf);
:UNNUMBERED: t
:END:
#+begin_src matlab
%% Initialize the Laplace variable
s = zpk('s');
#+end_src
The weighting function formula use is:
#+name: eq:weight_formula
\begin{equation}
W(s) = \left( \frac{
\hfill{} \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}
#+begin_src matlab
%% Create the weighting function according to formula
W = (((1/args.w0)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.Ginf)^(2/args.n)))*s + ...
(args.G0/args.Gc)^(1/args.n))/...
((1/args.Ginf)^(1/args.n)*(1/args.w0)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.Ginf)^(2/args.n)))*s + ...
@ -2660,7 +2745,7 @@ W = (((1/args.w0)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.Ginf)^(
:UNNUMBERED: t
:END:
#+begin_src matlab
% Custom validation function
%% Custom validation function
function mustBeBetween(a,b,c)
if ~((a > b && b > c) || (c > b && b > a))
eid = 'createWeight:inputError';
@ -2672,7 +2757,6 @@ function mustBeBetween(a,b,c)
** =generateCF=: Generate Complementary Filters
:PROPERTIES:
:header-args:matlab+: :tangle matlab/src/generateCF.m
:header-args:matlab+: :comments none :mkdirp yes :eval no
:END:
<<sec:generateCF>>
@ -2687,7 +2771,7 @@ This Matlab function is accessible [[file:matlab/src/generateCF.m][here]].
function [H1, H2] = generateCF(W1, W2, args)
% createWeight -
%
% Syntax: [W] = generateCF(args)
% Syntax: [H1, H2] = generateCF(W1, W2, args)
%
% Inputs:
% - W1 - Weighting Function for H1
@ -2706,6 +2790,7 @@ function [H1, H2] = generateCF(W1, W2, args)
:UNNUMBERED: t
:END:
#+begin_src matlab
%% Argument validation
arguments
W1
W2
@ -2719,15 +2804,18 @@ end
:UNNUMBERED: t
:END:
#+begin_src matlab
%% The generalized plant is defined
P = [W1 -W1;
0 W2;
1 0];
#+end_src
#+begin_src matlab :results output replace :exports both
%% The standard H-infinity synthesis is performed
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', args.method, 'DISPLAY', args.display);
#+end_src
#+begin_src matlab
%% H1 is defined as the complementary of H2
H1 = 1 - H2;
#+end_src

View File

@ -1,7 +1,7 @@
function [H1, H2] = generateCF(W1, W2, args)
% createWeight -
%
% Syntax: [W] = generateCF(args)
% Syntax: [H1, H2] = generateCF(W1, W2, args)
%
% Inputs:
% - W1 - Weighting Function for H1
@ -14,6 +14,7 @@ function [H1, H2] = generateCF(W1, W2, args)
% - H1 - Generated H1 Filter
% - H2 - Generated H2 Filter
%% Argument validation
arguments
W1
W2
@ -21,10 +22,13 @@ arguments
args.display char {mustBeMember(args.display,{'on', 'off'})} = 'on'
end
%% The generalized plant is defined
P = [W1 -W1;
0 W2;
1 0];
%% The standard H-infinity synthesis is performed
[H2, ~, gamma, ~] = hinfsyn(P, 1, 1,'TOLGAM', 0.001, 'METHOD', args.method, 'DISPLAY', args.display);
%% H1 is defined as the complementary of H2
H1 = 1 - H2;

View File

@ -11,8 +11,9 @@ function [W] = generateWF(args)
% - w0 - Frequency at which |W(j w0)| = Gc [rad/s]
%
% Outputs:
% - W - Generated Weight
% - W - Generated Weighting Function
%% Argument validation
arguments
args.n (1,1) double {mustBeInteger, mustBePositive} = 1
args.G0 (1,1) double {mustBeNumeric, mustBePositive} = 0.1
@ -21,16 +22,19 @@ arguments
args.w0 (1,1) double {mustBeNumeric, mustBePositive} = 1
end
% Verification of correct relation between G0, Gc and Ginf
mustBeBetween(args.G0, args.Gc, args.Ginf);
%% Initialize the Laplace variable
s = zpk('s');
%% Create the weighting function according to formula
W = (((1/args.w0)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.Ginf)^(2/args.n)))*s + ...
(args.G0/args.Gc)^(1/args.n))/...
((1/args.Ginf)^(1/args.n)*(1/args.w0)*sqrt((1-(args.G0/args.Gc)^(2/args.n))/(1-(args.Gc/args.Ginf)^(2/args.n)))*s + ...
(1/args.Gc)^(1/args.n)))^args.n;
% Custom validation function
%% Custom validation function
function mustBeBetween(a,b,c)
if ~((a > b && b > c) || (c > b && b > a))
eid = 'createWeight:inputError';