diff --git a/index.html b/index.html index d671c53..23be0da 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,7 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
- +\[ H(s) = \frac{1}{1 + s/\omega_0} \]
@@ -326,7 +365,7 @@ H = 1/<\[ H(s) = \frac{1}{1 + 2 \xi / \omega_0 s + s^2/\omega_0^2} \]
@@ -351,7 +390,7 @@ H = 1/<n = 2; w0 = 2*pi*11; G0 = 1/10; G1 = 1000; Gc = 1/2; +wL = Gc*(((G1/Gc)^(1/n)/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + (G0/Gc)^(1/n))/(1/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + 1))^n; + +n = 3; w0 = 2*pi*9; G0 = 10000; G1 = 0.1; Gc = 1/2; +wH = Gc*(((G1/Gc)^(1/n)/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + (G0/Gc)^(1/n))/(1/w0*sqrt((1-(G0/Gc)^(2/n))/((G1/Gc)^(2/n)-1))*s + 1))^n; +
\[ H(s) = \frac{s/\omega_0}{1 + s/\omega_0} \]
@@ -405,7 +463,7 @@ H = (s -
Figure 4: First Order High Pass Filter (png, pdf.
@@ -414,9 +472,9 @@ H = (s -\[ H(s) = \frac{s^2/\omega_0^2}{1 + 2 \xi / \omega_0 s + s^2/\omega_0^2} \]
@@ -430,7 +488,7 @@ H = (s -
Figure 5: Second Order High Pass Filter (png, pdf.
@@ -439,9 +497,9 @@ H = (s -\[ H(s) = \left( \frac{s/\omega_0}{1 + s/\omega_0} \right)^n \]
@@ -455,7 +513,7 @@ H = ( +
Figure 6: Combine Multiple First Order High Pass Filter (png, pdf.
@@ -466,21 +524,38 @@ H = ( -n = 4; +w0 = 2*pi; +A = 10; + +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; +bodeFig({G}) +
n = 4; % Order of the filter Rp = 3; % Maximum peak-to-peak ripple [dB] @@ -492,7 +567,7 @@ H = ss(A, B, C, D -+ --diff --git a/index.org b/index.org index 085472f..881e656 100644 --- a/index.org +++ b/index.org @@ -15,7 +15,7 @@ #+HTML_HEAD: #+HTML_HEAD: -#+PROPERTY: header-args:latex :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/MEGA/These/LaTeX/}{config.tex}") +#+PROPERTY: header-args:latex :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/Cloud/tikz/org/}{config.tex}") #+PROPERTY: header-args:latex+ :imagemagick t :fit yes #+PROPERTY: header-args:latex+ :iminoptions -scale 100% -density 150 #+PROPERTY: header-args:latex+ :imoutoptions -quality 100 @@ -37,7 +37,6 @@ #+PROPERTY: header-args:matlab+ :output-dir figs :END: - * Matlab Init :noexport:ignore: #+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name) < -6 Complementary
+++ +8 Lead - Lag
+++++ +8.1 Lead
++++\[ H(s) = \frac{1 + s/\omega_z}{1 + s/\omega_p}, \quad \omega_z < \omega_p \] +
+ ++
+ +- +
[ ]
Find a nice parametrisation to be able to specify the center frequency and the phase added- +
[ ]
Compute also the change in magnitude++ + + +h = 2.0; +wz = 2*pi/h; % [rad/s] +wp = 2*pi*h; % [rad/s] + +H = (1 + s/wz)/(1 + s/wp); ++++ +8.2 Lag
++++\[ H(s) = \frac{1 + s/\omega_z}{1 + s/\omega_p}, \quad \omega_z > \omega_p \] +
+ ++
+ +- +
[ ]
Find a nice parametrisation to be able to specify the center frequency and the phase added- +
[ ]
Compute also the change in magnitude++ + + +h = 2.0; +wz = 2*pi*h; % [rad/s] +wp = 2*pi/h; % [rad/s] + +H = (1 + s/wz)/(1 + s/wp); ++++8.3 Lead Lag
++++\[ H(s) = \frac{1 + s/\omega_z}{1 + s/\omega_p} \frac{1 + s/\omega_z}{1 + s/\omega_p}, \quad \omega_z > \omega_p \] +
+ +++ + + +wz1 = 2*pi*1; % [rad/s] +wp1 = 2*pi*0.1; % [rad/s] +wz2 = 2*pi*10; % [rad/s] +wp2 = 2*pi*20; % [rad/s] + +H = (1 + s/wz1)/(1 + s/wp1)*(1 + s/wz2)/(1 + s/wp2); ++++9 Complementary
+++ +10 Performance Weight
+++++ + +w0 = 2*pi; % [rad/s] +A = 1e-2; +M = 5; + +H = (s/sqrt(M) + w0)^2/(s + w0*sqrt(A))^2; +++++
++11 Combine Filters
+++++ +11.1 Additive
++++
+- +
[ ]
Explain how phase and magnitude combine+11.2 Multiplicative
+> @@ -113,7 +112,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lpf_first_order.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlpf_first_order.csv}; \end{axis} \begin{axis}[% @@ -143,7 +142,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lpf_first_order.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlpf_first_order.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -213,7 +212,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lpf_second_order.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlpf_second_order.csv}; \end{axis} \begin{axis}[% @@ -243,7 +242,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lpf_second_order.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlpf_second_order.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -253,7 +252,6 @@ #+RESULTS: [[file:figs/lpf_second_order.png]] - ** Combine multiple filters \[ H(s) = \left( \frac{1}{1 + s/\omega_0} \right)^n \] @@ -313,7 +311,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lpf_multiple_first_order.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlpf_multiple_first_order.csv}; \end{axis} \begin{axis}[% @@ -343,15 +341,13 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lpf_multiple_first_order.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlpf_multiple_first_order.csv}; \end{axis} \end{tikzpicture} #+end_src #+name: fig:lpf_multiple_first_order #+caption: Combine Multiple First Order Low Pass Filter ([[./figs/lpf_multiple_first_order.png][png]], [[./figs/lpf_multiple_first_order.pdf][pdf]]. -#+RESULTS: -[[file:figs/lpf_multiple_first_order.png]] ** Nice combination @@ -427,7 +423,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/hpf_first_order.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/mathpf_first_order.csv}; \end{axis} \begin{axis}[% @@ -457,7 +453,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/hpf_first_order.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/mathpf_first_order.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -527,7 +523,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/hpf_second_order.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/mathpf_second_order.csv}; \end{axis} \begin{axis}[% @@ -557,7 +553,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/hpf_second_order.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/mathpf_second_order.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -627,7 +623,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/hpf_multiple_first_order.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/mathpf_multiple_first_order.csv}; \end{axis} \begin{axis}[% @@ -657,7 +653,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/hpf_multiple_first_order.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/mathpf_multiple_first_order.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -673,6 +669,18 @@ * Notch +* Bump +#+begin_src matlab + n = 4; + w0 = 2*pi; + A = 10; + + 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; + bodeFig({G}) +#+end_src + + * Chebyshev ** Chebyshev Type I @@ -734,7 +742,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/cheby1_hpf.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matcheby1_hpf.csv}; \end{axis} \begin{axis}[% @@ -764,7 +772,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/cheby1_hpf.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matcheby1_hpf.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -838,7 +846,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lead_filter.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlead_filter.csv}; \end{axis} \begin{axis}[% @@ -868,7 +876,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lead_filter.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlead_filter.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -941,7 +949,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lag_filter.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlag_filter.csv}; \end{axis} \begin{axis}[% @@ -971,7 +979,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lag_filter.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlag_filter.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -1042,7 +1050,7 @@ yminorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lead_lag_filter.csv}; + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlead_lag_filter.csv}; \end{axis} \begin{axis}[% @@ -1072,7 +1080,7 @@ ymajorgrids ] \addplot[color=black, mark=none] - table [x=freqs, y=phase, col sep=comma] {/home/thomas/MEGA/These/Matlab/filters/mat/lead_lag_filter.csv}; + table [x=freqs, y=phase, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matlead_lag_filter.csv}; \end{axis} \end{tikzpicture} #+end_src @@ -1083,8 +1091,132 @@ [[file:figs/lead_lag_filter.png]] * Complementary +* Performance Weight + +#+begin_src matlab + w0 = 2*pi; % [rad/s] + A = 1e-2; + M = 5; + + H = (s/sqrt(M) + w0)^2/(s + w0*sqrt(A))^2; +#+end_src + +#+begin_src matlab :exports none + freqs = logspace(-2, 2, 1000); + resp = squeeze(freqresp(inv(H), freqs, 'Hz')); + Ha = abs(resp); + Hp = 180/pi*phase(resp); + + T = table(freqs', Ha, Hp, 'VariableNames', {'freqs', 'amplitude', 'phase'}); + writetable(T,'mat/weight_first_order.csv'); +#+end_src + +#+begin_src latex :file weight_first_order.pdf :tangle figs/weight_first_order.tex :exports results + \setlength\fwidth{8cm} + \setlength\fheight{4cm} + + \definecolor{mycolor1}{rgb}{0.00000,0.44700,0.74100}% + \definecolor{mycolor2}{rgb}{0.85000,0.32500,0.09800}% + + \begin{tikzpicture} + \begin{axis}[% + width=\fwidth, + height=\fheight, + at={(0,0)}, + scale only axis, + separate axis lines, + every outer x axis line/.append style={black}, + every x tick label/.append style={font=\color{black}}, + every x tick/.append style={black}, + xmode=log, + xmin=0.01, + xmax=100, + xminorticks=true, + xlabel={Frequency [Hz]}, + every outer y axis line/.append style={black}, + every y tick label/.append style={font=\color{black}}, + every y tick/.append style={black}, + ymode=log, + ymin=5e-3, + ymax=1e1, + yminorticks=true, + ylabel={Amplitude}, + axis background/.style={fill=white}, + xmajorgrids, + xminorgrids, + ymajorgrids, + yminorgrids + ] + \addplot[color=black, mark=none] + table [x=freqs, y=amplitude, col sep=comma] {/home/thomas/Cloud/thesis/matlab/filters/matweight_first_order.csv}; + + \draw[dashed] (0.01,1e-2) -- (1,1e-2) node[right]{$A$}; + \draw[dashed] (1,5) node[left]{$M$} -- (100,5); + \draw[dashed] (1,1) -- (1,0.5) node[below]{$\omega_b^*$}; + \end{axis} + \end{tikzpicture} +#+end_src + +#+RESULTS: +[[file:figs/weight_first_order.png]] + * Combine Filters ** Additive - [ ] Explain how phase and magnitude combine ** Multiplicative +* Filters representing noise +Let's consider a noise $n$ that is shaped from a white-noise $\tilde{n}$ with unitary PSD ($\Phi_\tilde{n}(\omega) = 1$) using a transfer function $G(s)$. +The PSD of $n$ is then: +\[ \Phi_n(\omega) = |G(j\omega)|^2 \Phi_{\tilde{n}}(\omega) = |G(j\omega)|^2 \] + +The PSD $\Phi_n(\omega)$ is expressed in $\text{unit}^2/\text{Hz}$. + +And the root mean square (RMS) of $n(t)$ is: +\[ \sigma_n = \sqrt{\int_{0}^{\infty} \Phi_n(\omega) d\omega} \] + +** First Order Low Pass Filter +\[ G(s) = \frac{g_0}{1 + \frac{s}{\omega_c}} \] + +#+begin_src matlab + g0 = 1; % Noise Density in unit/sqrt(Hz) + wc = 1; % Cut-Off frequency [rad/s] + + G = g0/(1 + s/wc); + + % Frequency vector [Hz] + freqs = logspace(-3, 3, 1000); + + % PSD of n in [unit^2/Hz] + Phi_n = abs(squeeze(freqresp(G, freqs, 'Hz'))).^2; + + % RMS value of n in [unit, rms] + sigma_n = sqrt(trapz(freqs, Phi_n)) +#+end_src + +\[ \sigma = \frac{1}{2} g_0 \sqrt{\omega_c} \] +with: +- $g_0$ the Noise Density of $n$ in $\text{unit}/\sqrt{Hz}$ +- $\omega_c$ the bandwidth over which the noise is located, in rad/s +- $\sigma$ the rms noise + +If the cut-off frequency is to be expressed in Hz: +\[ \sigma = \frac{1}{2} g_0 \sqrt{2\pi f_c} = \sqrt{\frac{\pi}{2}} g_0 \sqrt{f_c} \] + + +Thus, if a sensor is said to have a RMS noise of $\sigma = 10 nm\ rms$ over a bandwidth of $\omega_c = 100 rad/s$, we can estimated the noise density of the sensor to be (supposing a first order low pass filter noise shape): +\[ g_0 = \frac{2 \sigma}{\sqrt{\omega_c}} \quad \left[ m/\sqrt{Hz} \right] \] + +#+begin_src matlab :results value replace + 2*10e-9/sqrt(100) +#+end_src + +#+RESULTS: +: 2e-09 + +#+begin_src matlab :results value replace + 6*0.5*20e-12*sqrt(2*pi*100) +#+end_src + +#+RESULTS: +: 1.504e-09