diff --git a/matlab/index.org b/matlab/index.org index 9889f23..d3ea427 100644 --- a/matlab/index.org +++ b/matlab/index.org @@ -820,14 +820,16 @@ We see that the blue complementary filters with a lower maximum norm permits to ** TODO More Complete example with model uncertainty * Complementary filters using analytical formula +* Methods of complementary filter synthesis +** Complementary filters using analytical formula :PROPERTIES: :header-args:matlab+: :tangle matlab/comp_filters_analytical.m :header-args:matlab+: :comments org :mkdirp yes :END: <> -** Introduction :ignore: -** ZIP file containing the data and matlab files :ignore: +*** Introduction :ignore: +*** ZIP file containing the data and matlab files :ignore: #+begin_src bash :exports none :results none if [ matlab/comp_filters_analytical.m -nt data/comp_filters_analytical.zip ]; then cp matlab/comp_filters_analytical.m comp_filters_analytical.m; @@ -841,7 +843,7 @@ We see that the blue complementary filters with a lower maximum norm permits to All the files (data and Matlab scripts) are accessible [[file:data/comp_filters_analytical.zip][here]]. #+end_note -** Matlab Init :noexport:ignore: +*** Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) <> #+end_src @@ -854,7 +856,7 @@ We see that the blue complementary filters with a lower maximum norm permits to freqs = logspace(-1, 3, 1000); #+end_src -** Analytical 1st order complementary filters +*** Analytical 1st order complementary filters First order complementary filters are defined with following equations: \begin{align} H_L(s) = \frac{1}{1 + \frac{s}{\omega_0}}\\ @@ -906,7 +908,7 @@ Their bode plot is shown figure [[fig:comp_filter_1st_order]]. #+CAPTION: Bode plot of first order complementary filter ([[./figs/comp_filter_1st_order.png][png]], [[./figs/comp_filter_1st_order.pdf][pdf]]) [[file:figs/comp_filter_1st_order.png]] -** Second Order Complementary Filters +*** Second Order Complementary Filters We here use analytical formula for the complementary filters $H_L$ and $H_H$. The first two formulas that are used to generate complementary filters are: @@ -1006,7 +1008,7 @@ We now study the maximum norm of the filters function of the parameter $\alpha$. #+CAPTION: Evolution of the H-Infinity norm of the complementary filters with the parameter $\alpha$ ([[./figs/param_alpha_hinf_norm.png][png]], [[./figs/param_alpha_hinf_norm.pdf][pdf]]) [[file:figs/param_alpha_hinf_norm.png]] -** Third Order Complementary Filters +*** Third Order Complementary Filters The following formula gives complementary filters with slopes of $-3$ and $3$: \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)}\\ @@ -1053,15 +1055,15 @@ The filters are defined below and the result is shown on figure [[fig:complement #+CAPTION: Third order complementary filters using the analytical formula ([[./figs/complementary_filters_third_order.png][png]], [[./figs/complementary_filters_third_order.pdf][pdf]]) [[file:figs/complementary_filters_third_order.png]] -* H-Infinity synthesis of complementary filters +** H-Infinity synthesis of complementary filters :PROPERTIES: :header-args:matlab+: :tangle matlab/h_inf_synthesis_complementary_filters.m :header-args:matlab+: :comments org :mkdirp yes :END: <> -** Introduction :ignore: -** ZIP file containing the data and matlab files :ignore: +*** Introduction :ignore: +*** ZIP file containing the data and matlab files :ignore: #+begin_src bash :exports none :results none if [ matlab/h_inf_synthesis_complementary_filters.m -nt data/h_inf_synthesis_complementary_filters.zip ]; then cp matlab/h_inf_synthesis_complementary_filters.m h_inf_synthesis_complementary_filters.m; @@ -1075,7 +1077,7 @@ The filters are defined below and the result is shown on figure [[fig:complement All the files (data and Matlab scripts) are accessible [[file:data/h_inf_synthesis_complementary_filters.zip][here]]. #+end_note -** Matlab Init :noexport:ignore: +*** Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) <> #+end_src @@ -1088,7 +1090,7 @@ The filters are defined below and the result is shown on figure [[fig:complement freqs = logspace(-1, 3, 1000); #+end_src -** Synthesis Architecture +*** Synthesis Architecture 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$). @@ -1115,7 +1117,7 @@ We then see that $w_L$ and $w_H$ can be used to shape both $H_L$ and $H_H$ while #+caption: $\mathcal{H}_\infty$ synthesis of the complementary filters [[file:figs-tikz/sf_hinf_filters_b.png]] -** Weights +*** Weights #+begin_src matlab omegab = 2*pi*9; @@ -1149,7 +1151,7 @@ We then see that $w_L$ and $w_H$ can be used to shape both $H_L$ and $H_H$ while #+CAPTION: Weights on the complementary filters $w_L$ and $w_H$ and the associated performance weights ([[./figs/weights_wl_wh.png][png]], [[./figs/weights_wl_wh.pdf][pdf]]) [[file:figs/weights_wl_wh.png]] -** H-Infinity Synthesis +*** H-Infinity Synthesis We define the generalized plant $P$ on matlab. #+begin_src matlab P = [0 wL; @@ -1189,7 +1191,7 @@ We then define the high pass filter $H_H = 1 - H_L$. The bode plot of both $H_L$ Hh_hinf = 1 - Hl_hinf; #+end_src -** Obtained Complementary Filters +*** Obtained Complementary Filters The obtained complementary filters are shown on figure [[fig:hinf_filters_results]]. @@ -1223,19 +1225,19 @@ The obtained complementary filters are shown on figure [[fig:hinf_filters_result #+CAPTION: Obtained complementary filters using $\mathcal{H}_\infty$ synthesis ([[./figs/hinf_filters_results.png][png]], [[./figs/hinf_filters_results.pdf][pdf]]) [[file:figs/hinf_filters_results.png]] -* Feedback Control Architecture to generate Complementary Filters +** Feedback Control Architecture to generate Complementary Filters :PROPERTIES: :header-args:matlab+: :tangle matlab/feedback_generate_comp_filters.m :header-args:matlab+: :comments org :mkdirp yes :END: <> -** Introduction :ignore: +*** Introduction :ignore: The idea is here to use the fact that in a classical feedback architecture, $S + T = 1$, in order to design complementary filters. Thus, all the tools that has been developed for classical feedback control can be used for complementary filter design. -** ZIP file containing the data and matlab files :ignore: +*** ZIP file containing the data and matlab files :ignore: #+begin_src bash :exports none :results none if [ matlab/feedback_generate_comp_filters.m -nt data/feedback_generate_comp_filters.zip ]; then cp matlab/feedback_generate_comp_filters.m feedback_generate_comp_filters.m; @@ -1249,7 +1251,7 @@ Thus, all the tools that has been developed for classical feedback control can b All the files (data and Matlab scripts) are accessible [[file:data/feedback_generate_comp_filters.zip][here]]. #+end_note -** Matlab Init :noexport:ignore: +*** Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) <> #+end_src @@ -1262,7 +1264,7 @@ Thus, all the tools that has been developed for classical feedback control can b freqs = logspace(-2, 2, 1000); #+end_src -** Architecture +*** Architecture #+name: fig:complementary_filters_feedback_architecture #+caption: Architecture used to generate the complementary filters [[file:figs-tikz/complementary_filters_feedback_architecture.png]] @@ -1278,7 +1280,7 @@ A simple choice is: Which contains two integrator and a lead. $\omega_c$ is used to tune the crossover frequency and $\alpha$ the trade-off "bump" around blending frequency and filtering away from blending frequency. -** Loop Gain Design +*** Loop Gain Design Let's first define the loop gain $L$. #+begin_src matlab wc = 2*pi*1; @@ -1317,7 +1319,7 @@ Let's first define the loop gain $L$. #+CAPTION: Bode plot of the loop gain $L$ ([[./figs/loop_gain_bode_plot.png][png]], [[./figs/loop_gain_bode_plot.pdf][pdf]]) [[file:figs/loop_gain_bode_plot.png]] -** Complementary Filters Obtained +*** Complementary Filters Obtained We then compute the resulting low pass and high pass filters. #+begin_src matlab Hl = L/(L + 1); @@ -1353,10 +1355,10 @@ We then compute the resulting low pass and high pass filters. #+CAPTION: Low pass and High pass filters $H_L$ and $H_H$ for different values of $\alpha$ ([[./figs/low_pass_high_pass_filters.png][png]], [[./figs/low_pass_high_pass_filters.pdf][pdf]]) [[file:figs/low_pass_high_pass_filters.png]] -* Analytical Formula found in the literature +** Analytical Formula found in the literature <> -** Analytical Formula +*** Analytical Formula cite:min15_compl_filter_desig_angle_estim \begin{align*} H_L(s) = \frac{K_p s + K_i}{s^2 + K_p s + K_i} \\ @@ -1392,7 +1394,7 @@ cite:baerveldt97_low_cost_low_weigh_attit H_H(s) = \frac{\tau^2 s^2}{(\tau s + 1)^2} \end{align*} -** Matlab Init :noexport:ignore: +*** Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) <> #+end_src @@ -1401,7 +1403,7 @@ cite:baerveldt97_low_cost_low_weigh_attit <> #+end_src -** Matlab +*** Matlab #+begin_src matlab omega0 = 1*2*pi; % [rad/s] tau = 1/omega0; % [s] @@ -1461,10 +1463,10 @@ cite:baerveldt97_low_cost_low_weigh_attit #+CAPTION: Comparison of some complementary filters found in the literature ([[./figs/comp_filters_literature.png][png]], [[./figs/comp_filters_literature.pdf][pdf]]) [[file:figs/comp_filters_literature.png]] -** Discussion +*** Discussion Analytical Formula found in the literature provides either no parameter for tuning the robustness / performance trade-off. -* Comparison of the different methods of synthesis +** Comparison of the different methods of synthesis <> 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: - 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.