542 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			Org Mode
		
	
	
	
	
	
			
		
		
	
	
			542 lines
		
	
	
		
			17 KiB
		
	
	
	
		
			Org Mode
		
	
	
	
	
	
#+TITLE: Measurements on the instrumentation
 | 
						|
:DRAWER:
 | 
						|
#+STARTUP: overview
 | 
						|
 | 
						|
#+LANGUAGE: en
 | 
						|
#+EMAIL: dehaeze.thomas@gmail.com
 | 
						|
#+AUTHOR: Dehaeze Thomas
 | 
						|
 | 
						|
#+HTML_LINK_HOME: ../index.html
 | 
						|
#+HTML_LINK_UP: ../index.html
 | 
						|
 | 
						|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../css/htmlize.css"/>
 | 
						|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../css/readtheorg.css"/>
 | 
						|
#+HTML_HEAD: <link rel="stylesheet" type="text/css" href="../css/zenburn.css"/>
 | 
						|
#+HTML_HEAD: <script type="text/javascript" src="../js/jquery.min.js"></script>
 | 
						|
#+HTML_HEAD: <script type="text/javascript" src="../js/bootstrap.min.js"></script>
 | 
						|
#+HTML_HEAD: <script type="text/javascript" src="../js/jquery.stickytableheaders.min.js"></script>
 | 
						|
#+HTML_HEAD: <script type="text/javascript" src="../js/readtheorg.js"></script>
 | 
						|
 | 
						|
#+HTML_MATHJAX: align: center tagside: right font: TeX
 | 
						|
 | 
						|
#+PROPERTY: header-args:matlab  :session *MATLAB*
 | 
						|
#+PROPERTY: header-args:matlab+ :comments org
 | 
						|
#+PROPERTY: header-args:matlab+ :results none
 | 
						|
#+PROPERTY: header-args:matlab+ :exports both
 | 
						|
#+PROPERTY: header-args:matlab+ :eval no-export
 | 
						|
#+PROPERTY: header-args:matlab+ :output-dir figs
 | 
						|
 | 
						|
#+PROPERTY: header-args:shell  :eval no-export
 | 
						|
:END:
 | 
						|
 | 
						|
* Measure of the noise of the Voltage Amplifier
 | 
						|
  :PROPERTIES:
 | 
						|
  :header-args:matlab+: :tangle matlab/meas_volt_amp.m
 | 
						|
  :header-args:matlab+: :comments org :mkdirp yes
 | 
						|
  :END:
 | 
						|
  <<sec:meas_volt_amp>>
 | 
						|
 | 
						|
** ZIP file containing the data and matlab files                     :ignore:
 | 
						|
#+begin_src bash :exports none :results none
 | 
						|
  if [ meas_volt_amp.m -nt data/meas_volt_amp.zip ]; then
 | 
						|
    zip data/meas_volt_amp \
 | 
						|
        mat/data_003.mat \
 | 
						|
        mat/data_004.mat \
 | 
						|
        mat/data_005.mat \
 | 
						|
        mat/data_006.mat \
 | 
						|
        meas_volt_amp.m
 | 
						|
  fi
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_note
 | 
						|
  All the files (data and Matlab scripts) are accessible [[file:data/meas_volt_amp.zip][here]].
 | 
						|
#+end_note
 | 
						|
 | 
						|
** Measurement Description
 | 
						|
*Goal*:
 | 
						|
- Determine the Voltage Amplifier noise
 | 
						|
 | 
						|
*Setup*:
 | 
						|
- The two inputs (differential) of the voltage amplifier are shunted with 50Ohms
 | 
						|
- The AC/DC option of the Voltage amplifier is on AC
 | 
						|
- The low pass filter is set to 1hHz
 | 
						|
- We measure the output of the voltage amplifier with a 16bits ADC of the Speedgoat
 | 
						|
 | 
						|
*Measurements*:
 | 
						|
- =data_003=: Ampli OFF
 | 
						|
- =data_004=: Ampli ON set to 20dB
 | 
						|
- =data_005=: Ampli ON set to 40dB
 | 
						|
- =data_006=: Ampli ON set to 60dB
 | 
						|
 | 
						|
** Matlab Init                                              :noexport:ignore:
 | 
						|
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
 | 
						|
  <<matlab-dir>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_src matlab :exports none :results silent :noweb yes
 | 
						|
  <<matlab-init>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
** Load data
 | 
						|
#+begin_src matlab :results none
 | 
						|
  amp_off = load('mat/data_003.mat', 'data'); amp_off = amp_off.data(:, [1,3]);
 | 
						|
  amp_20d = load('mat/data_004.mat', 'data'); amp_20d = amp_20d.data(:, [1,3]);
 | 
						|
  amp_40d = load('mat/data_005.mat', 'data'); amp_40d = amp_40d.data(:, [1,3]);
 | 
						|
  amp_60d = load('mat/data_006.mat', 'data'); amp_60d = amp_60d.data(:, [1,3]);
 | 
						|
#+end_src
 | 
						|
 | 
						|
** Time Domain
 | 
						|
The time domain signals are shown on figure [[fig:ampli_noise_time]].
 | 
						|
 | 
						|
#+begin_src matlab :results none :exports none
 | 
						|
  figure;
 | 
						|
  hold on;
 | 
						|
  plot(amp_off(:, 2), amp_off(:, 1), 'DisplayName', 'OFF');
 | 
						|
  plot(amp_20d(:, 2), amp_20d(:, 1), 'DisplayName', '20dB');
 | 
						|
  plot(amp_40d(:, 2), amp_40d(:, 1), 'DisplayName', '40dB');
 | 
						|
  plot(amp_60d(:, 2), amp_60d(:, 1), 'DisplayName', '60dB');
 | 
						|
  hold off;
 | 
						|
  legend('Location', 'northeast');
 | 
						|
  xlabel('Time [s]');
 | 
						|
  ylabel('Voltage [V]');
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ampli_noise_time
 | 
						|
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
 | 
						|
#+begin_src matlab :var filepath="figs/ampli_noise_time.pdf" :var figsize="wide-normal" :post pdf2svg(file=*this*, ext="png")
 | 
						|
  <<plt-matlab>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ampli_noise_time
 | 
						|
#+CAPTION: Output of the amplifier
 | 
						|
#+RESULTS: fig:ampli_noise_time
 | 
						|
[[file:figs/ampli_noise_time.png]]
 | 
						|
 | 
						|
** Frequency Domain
 | 
						|
We first compute some parameters that will be used for the PSD computation.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  dt = amp_off(2, 2)-amp_off(1, 2);
 | 
						|
 | 
						|
  Fs = 1/dt; % [Hz]
 | 
						|
 | 
						|
  win = hanning(ceil(10*Fs));
 | 
						|
#+end_src
 | 
						|
 | 
						|
Then we compute the Power Spectral Density using =pwelch= function.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  [pxoff, f] = pwelch(amp_off(:,1), win, [], [], Fs);
 | 
						|
  [px20d, ~] = pwelch(amp_20d(:,1), win, [], [], Fs);
 | 
						|
  [px40d, ~] = pwelch(amp_40d(:,1), win, [], [], Fs);
 | 
						|
  [px60d, ~] = pwelch(amp_60d(:,1), win, [], [], Fs);
 | 
						|
#+end_src
 | 
						|
 | 
						|
We compute the theoretical ADC noise.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  q = 20/2^16; % quantization
 | 
						|
  Sq = q^2/12/1000; % PSD of the ADC noise
 | 
						|
#+end_src
 | 
						|
 | 
						|
Finally, the ASD is shown on figure [[fig:ampli_noise_psd]].
 | 
						|
#+begin_src matlab :results none :exports none
 | 
						|
  figure;
 | 
						|
  hold on;
 | 
						|
  plot(f, sqrt(pxoff), 'DisplayName', 'OFF');
 | 
						|
  plot(f, sqrt(px20d), 'DisplayName', '20dB');
 | 
						|
  plot(f, sqrt(px40d), 'DisplayName', '40dB');
 | 
						|
  plot(f, sqrt(px60d), 'DisplayName', '60dB');
 | 
						|
  plot([0.1, 500], [sqrt(Sq), sqrt(Sq)], 'k--');
 | 
						|
  hold off;
 | 
						|
  set(gca, 'xscale', 'log');
 | 
						|
  set(gca, 'yscale', 'log');
 | 
						|
  xlabel('Frequency [Hz]'); ylabel('ASD of the measured Voltage $\left[\frac{V}{\sqrt{Hz}}\right]$')
 | 
						|
  legend('Location', 'northeast');
 | 
						|
  xlim([0.1, 500]);
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ampli_noise_psd
 | 
						|
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
 | 
						|
#+begin_src matlab :var filepath="figs/ampli_noise_psd.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
 | 
						|
  <<plt-matlab>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ampli_noise_psd
 | 
						|
#+CAPTION: Amplitude Spectral Density of the measured voltage at the output of the voltage amplifier
 | 
						|
#+RESULTS: fig:ampli_noise_psd
 | 
						|
[[file:figs/ampli_noise_psd.png]]
 | 
						|
 | 
						|
** Conclusion
 | 
						|
#+begin_important
 | 
						|
  *Questions*:
 | 
						|
  - Where does those sharp peaks comes from? Can this be due to aliasing?
 | 
						|
 | 
						|
  Noise induced by the voltage amplifiers seems not to be a limiting factor as we have the same noise when they are OFF and ON.
 | 
						|
#+end_important
 | 
						|
 | 
						|
* Measure of the influence of the AC/DC option on the voltage amplifiers
 | 
						|
  :PROPERTIES:
 | 
						|
  :header-args:matlab+: :tangle matlab/meas_noise_ac_dc.m
 | 
						|
  :header-args:matlab+: :comments org :mkdirp yes
 | 
						|
  :END:
 | 
						|
  <<sec:meas_noise_ac_dc>>
 | 
						|
 | 
						|
** ZIP file containing the data and matlab files                     :ignore:
 | 
						|
#+begin_src bash :exports none :results none
 | 
						|
  if [ meas_noise_ac_dc.m -nt data/meas_noise_ac_dc.zip ]; then
 | 
						|
    zip data/meas_noise_ac_dc \
 | 
						|
        mat/data_012.mat \
 | 
						|
        mat/data_013.mat \
 | 
						|
        meas_noise_ac_dc.m
 | 
						|
  fi
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_note
 | 
						|
  All the files (data and Matlab scripts) are accessible [[file:data/meas_noise_ac_dc.zip][here]].
 | 
						|
#+end_note
 | 
						|
 | 
						|
** Measurement Description
 | 
						|
*Goal*:
 | 
						|
- Measure the influence of the high-pass filter option of the voltage amplifiers
 | 
						|
 | 
						|
*Setup*:
 | 
						|
- One geophone is located on the marble.
 | 
						|
- It's signal goes to two voltage amplifiers with a gain of 60dB.
 | 
						|
- One voltage amplifier is on the AC option, the other is on the DC option.
 | 
						|
 | 
						|
*Measurements*:
 | 
						|
First measurement (=mat/data_014.mat= file):
 | 
						|
| Column | Signal                     |
 | 
						|
|--------+----------------------------|
 | 
						|
|      1 | Amplifier 1 with AC option |
 | 
						|
|      2 | Amplifier 2 with DC option |
 | 
						|
|      3 | Time                       |
 | 
						|
 | 
						|
Second measurement (=mat/data_015.mat= file):
 | 
						|
| Column | Signal                     |
 | 
						|
|--------+----------------------------|
 | 
						|
|      1 | Amplifier 1 with DC option |
 | 
						|
|      2 | Amplifier 2 with AC option |
 | 
						|
|      3 | Time                       |
 | 
						|
 | 
						|
#+name: fig:volt_amp_setup
 | 
						|
#+caption: Picture of the two voltages amplifiers
 | 
						|
#+attr_html: :width 500px
 | 
						|
[[file:./img/IMG_20190503_170936.jpg]]
 | 
						|
 | 
						|
** Matlab Init                                              :noexport:ignore:
 | 
						|
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
 | 
						|
  <<matlab-dir>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_src matlab :exports none :results silent :noweb yes
 | 
						|
  <<matlab-init>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
** Load data
 | 
						|
We load the data of the z axis of two geophones.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  meas14 = load('mat/data_014.mat', 'data'); meas14 = meas14.data;
 | 
						|
  meas15 = load('mat/data_015.mat', 'data'); meas15 = meas15.data;
 | 
						|
#+end_src
 | 
						|
 | 
						|
** Time Domain
 | 
						|
The signals are shown on figure [[fig:ac_dc_option_time]].
 | 
						|
#+begin_src matlab :results none :exports none
 | 
						|
  figure;
 | 
						|
  hold on;
 | 
						|
  plot(meas14(:, 3), meas14(:, 1), 'DisplayName', 'Amp1 - AC');
 | 
						|
  plot(meas14(:, 3), meas14(:, 2), 'DisplayName', 'Amp2 - DC');
 | 
						|
  plot(meas15(:, 3), meas15(:, 1), 'DisplayName', 'Amp1 - DC');
 | 
						|
  plot(meas15(:, 3), meas15(:, 2), 'DisplayName', 'Amp2 - AC');
 | 
						|
  hold off;
 | 
						|
  legend('Location', 'bestoutside');
 | 
						|
  xlabel('Time [s]');
 | 
						|
  ylabel('Voltage [V]');
 | 
						|
  xlim([0, 100]);
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ac_dc_option_time
 | 
						|
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
 | 
						|
#+begin_src matlab :var filepath="figs/ac_dc_option_time.pdf" :var figsize="full-normal" :post pdf2svg(file=*this*, ext="png")
 | 
						|
  <<plt-matlab>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ac_dc_option_time
 | 
						|
#+CAPTION: Comparison of the signals going through the Voltage amplifiers
 | 
						|
#+RESULTS: fig:ac_dc_option_time
 | 
						|
[[file:figs/ac_dc_option_time.png]]
 | 
						|
 | 
						|
** Frequency Domain
 | 
						|
We first compute some parameters that will be used for the PSD computation.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  dt = meas14(2, 3)-meas14(1, 3);
 | 
						|
 | 
						|
  Fs = 1/dt; % [Hz]
 | 
						|
 | 
						|
  win = hanning(ceil(10*Fs));
 | 
						|
#+end_src
 | 
						|
 | 
						|
Then we compute the Power Spectral Density using =pwelch= function.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  [pxamp1ac, f] = pwelch(meas14(:, 1), win, [], [], Fs);
 | 
						|
  [pxamp2dc, ~] = pwelch(meas14(:, 2), win, [], [], Fs);
 | 
						|
 | 
						|
  [pxamp1dc, ~] = pwelch(meas15(:, 1), win, [], [], Fs);
 | 
						|
  [pxamp2ac, ~] = pwelch(meas15(:, 2), win, [], [], Fs);
 | 
						|
#+end_src
 | 
						|
 | 
						|
The ASD of the signals are compare on figure [[fig:ac_dc_option_asd]].
 | 
						|
#+begin_src matlab :results none :exports none
 | 
						|
  figure;
 | 
						|
  hold on;
 | 
						|
  plot(f, sqrt(pxamp1ac), 'DisplayName', 'Amp1 - AC');
 | 
						|
  plot(f, sqrt(pxamp2dc), 'DisplayName', 'Amp2 - DC');
 | 
						|
  plot(f, sqrt(pxamp1dc), 'DisplayName', 'Amp1 - DC');
 | 
						|
  plot(f, sqrt(pxamp2ac), 'DisplayName', 'Amp2 - AC');
 | 
						|
  hold off;
 | 
						|
  set(gca, 'xscale', 'log');
 | 
						|
  set(gca, 'yscale', 'log');
 | 
						|
  xlabel('Frequency [Hz]'); ylabel('ASD of the measured Voltage $\left[\frac{V}{\sqrt{Hz}}\right]$')
 | 
						|
  legend('Location', 'northeast');
 | 
						|
  xlim([0.1, 500]);
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ac_dc_option_asd
 | 
						|
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
 | 
						|
#+begin_src matlab :var filepath="figs/ac_dc_option_asd.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
 | 
						|
  <<plt-matlab>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:ac_dc_option_asd
 | 
						|
#+CAPTION: Amplitude Spectral Density of the measured signals
 | 
						|
#+RESULTS: fig:ac_dc_option_asd
 | 
						|
[[file:figs/ac_dc_option_asd.png]]
 | 
						|
 | 
						|
** Conclusion
 | 
						|
#+begin_important
 | 
						|
  - The voltage amplifiers include some very sharp high pass filters at 1.5Hz (maybe 4th order)
 | 
						|
  - There is a DC offset on the time domain signal because the DC-offset knob was not set to zero
 | 
						|
#+end_important
 | 
						|
 | 
						|
* Transfer function of the Low Pass Filter
 | 
						|
  :PROPERTIES:
 | 
						|
  :header-args:matlab+: :tangle matlab/low_pass_filter_measurements.m
 | 
						|
  :header-args:matlab+: :comments org :mkdirp yes
 | 
						|
  :END:
 | 
						|
  <<sec:low_pass_filter_measurements>>
 | 
						|
 | 
						|
** ZIP file containing the data and matlab files                     :ignore:
 | 
						|
#+begin_src bash :exports none :results none
 | 
						|
  if [ low_pass_filter_measurements.m -nt data/low_pass_filter_measurements.zip ]; then
 | 
						|
    zip data/low_pass_filter_measurements \
 | 
						|
        mat/data_018.mat \
 | 
						|
        mat/data_019.mat \
 | 
						|
        low_pass_filter_measurements.m
 | 
						|
  fi
 | 
						|
#+end_src
 | 
						|
 | 
						|
The computation files for this section are accessible [[file:data/low_pass_filter_measurements.zip][here]].
 | 
						|
 | 
						|
** First LPF with a Cut-off frequency of 160Hz
 | 
						|
*** Measurement Description
 | 
						|
*Goal*:
 | 
						|
- Measure the Low Pass Filter Transfer Function
 | 
						|
 | 
						|
The values of the components are:
 | 
						|
\begin{aligned}
 | 
						|
  R &= 1k\Omega \\
 | 
						|
  C &= 1\mu F
 | 
						|
\end{aligned}
 | 
						|
Which makes a cut-off frequency of $f_c = \frac{1}{RC} = 1000 rad/s = 160Hz$.
 | 
						|
 | 
						|
#+NAME: fig:lpf
 | 
						|
#+HEADER: :headers '("\\usepackage{tikz}" "\\usepackage{import}" "\\import{$HOME/MEGA/These/LaTeX/}{config.tex}")
 | 
						|
#+HEADER: :imagemagick t :fit yes :iminoptions -scale 100% -density 150 :imoutoptions -quality 100
 | 
						|
#+HEADER: :results raw replace :buffer no :eval no-export :exports both :mkdirp yes
 | 
						|
#+HEADER: :output-dir figs
 | 
						|
#+begin_src latex :file lpf.pdf :post pdf2svg(file=*this*, ext="png") :exports both
 | 
						|
  \begin{tikzpicture}
 | 
						|
    \draw (0,2)
 | 
						|
          to [R=\(R\)] ++(2,0) node[circ]
 | 
						|
          to ++(2,0)
 | 
						|
          ++(-2,0)
 | 
						|
          to [C=\(C\)] ++(0,-2) node[circ]
 | 
						|
          ++(-2,0)
 | 
						|
          to ++(2,0)
 | 
						|
          to ++(2,0)
 | 
						|
  \end{tikzpicture}
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:lpf
 | 
						|
#+CAPTION: Schematic of the Low Pass Filter used
 | 
						|
#+RESULTS: fig:lpf
 | 
						|
[[file:figs/lpf.png]]
 | 
						|
 | 
						|
 | 
						|
*Setup*:
 | 
						|
- We are measuring the signal from from Geophone with a BNC T
 | 
						|
- On part goes to column 1 through the LPF
 | 
						|
- The other part goes to column 2 without the LPF
 | 
						|
 | 
						|
*Measurements*:
 | 
						|
=mat/data_018.mat=:
 | 
						|
| Column | Signal               |
 | 
						|
|--------+----------------------|
 | 
						|
|      1 | Amplifier 1 with LPF |
 | 
						|
|      2 | Amplifier 2          |
 | 
						|
|      3 | Time                 |
 | 
						|
 | 
						|
#+name: fig:lpf_picture
 | 
						|
#+caption: Picture of the low pass filter used
 | 
						|
#+attr_html: :width 500px
 | 
						|
[[file:./img/IMG_20190507_102756.jpg]]
 | 
						|
 | 
						|
*** Matlab Init                                             :noexport:ignore:
 | 
						|
#+begin_src matlab :tangle no :exports none :results silent :noweb yes :var current_dir=(file-name-directory buffer-file-name)
 | 
						|
  <<matlab-dir>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_src matlab :exports none :results silent :noweb yes
 | 
						|
  <<matlab-init>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
*** Load data
 | 
						|
We load the data of the z axis of two geophones.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  data = load('mat/data_018.mat', 'data'); data = data.data;
 | 
						|
#+end_src
 | 
						|
 | 
						|
*** Transfer function of the LPF
 | 
						|
We compute the transfer function from the signal without the LPF to the signal measured with the LPF.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  dt = data(2, 3)-data(1, 3);
 | 
						|
 | 
						|
  Fs = 1/dt; % [Hz]
 | 
						|
 | 
						|
  win = hanning(ceil(10*Fs));
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_src matlab :results none
 | 
						|
  [Glpf, f] = tfestimate(data(:, 2), data(:, 1), win, [], [], Fs);
 | 
						|
#+end_src
 | 
						|
 | 
						|
We compare this transfer function with a transfer function corresponding to an ideal first order LPF with a cut-off frequency of $1000rad/s$.
 | 
						|
We obtain the result on figure [[fig:Glpf_bode]].
 | 
						|
#+begin_src matlab :results none
 | 
						|
  Gth = 1/(1+s/1000)
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_src matlab :results none
 | 
						|
  figure;
 | 
						|
  ax1 = subplot(2, 1, 1);
 | 
						|
  hold on;
 | 
						|
  plot(f, abs(Glpf));
 | 
						|
  plot(f, abs(squeeze(freqresp(Gth, f, 'Hz'))));
 | 
						|
  hold off;
 | 
						|
  set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
 | 
						|
  set(gca, 'XTickLabel',[]);
 | 
						|
  ylabel('Magnitude');
 | 
						|
 | 
						|
  ax2 = subplot(2, 1, 2);
 | 
						|
  hold on;
 | 
						|
  plot(f, mod(180+180/pi*phase(Glpf), 360)-180);
 | 
						|
  plot(f, 180/pi*unwrap(angle(squeeze(freqresp(Gth, f, 'Hz')))));
 | 
						|
  hold off;
 | 
						|
  set(gca, 'xscale', 'log');
 | 
						|
  ylim([-180, 180]);
 | 
						|
  yticks([-180, -90, 0, 90, 180]);
 | 
						|
  xlabel('Frequency [Hz]'); ylabel('Phase');
 | 
						|
 | 
						|
  linkaxes([ax1,ax2],'x');
 | 
						|
  xlim([1, 500]);
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:Glpf_bode
 | 
						|
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
 | 
						|
#+begin_src matlab :var filepath="figs/Glpf_bode.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
 | 
						|
  <<plt-matlab>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:Glpf_bode
 | 
						|
#+CAPTION: Bode Diagram of the measured Low Pass filter and the theoritical one
 | 
						|
#+RESULTS: fig:Glpf_bode
 | 
						|
[[file:figs/Glpf_bode.png]]
 | 
						|
*** Conclusion
 | 
						|
#+begin_important
 | 
						|
  As we want to measure things up to $500Hz$, we chose to change the value of the capacitor to obtain a cut-off frequency of $1kHz$.
 | 
						|
#+end_important
 | 
						|
 | 
						|
** Second LPF with a Cut-off frequency of 1000Hz
 | 
						|
*** Measurement description
 | 
						|
This time, the value are
 | 
						|
\begin{aligned}
 | 
						|
  R &= 1k\Omega \\
 | 
						|
  C &= 150nF
 | 
						|
\end{aligned}
 | 
						|
Which makes a low pass filter with a cut-off frequency of $f_c = 1060Hz$.
 | 
						|
 | 
						|
*** Load data
 | 
						|
We load the data of the z axis of two geophones.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  data = load('mat/data_019.mat', 'data'); data = data.data;
 | 
						|
#+end_src
 | 
						|
 | 
						|
*** Transfer function of the LPF
 | 
						|
We compute the transfer function from the signal without the LPF to the signal measured with the LPF.
 | 
						|
#+begin_src matlab :results none
 | 
						|
  dt = data(2, 3)-data(1, 3);
 | 
						|
 | 
						|
  Fs = 1/dt; % [Hz]
 | 
						|
 | 
						|
  win = hanning(ceil(10*Fs));
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_src matlab :results none
 | 
						|
  [Glpf, f] = tfestimate(data(:, 2), data(:, 1), win, [], [], Fs);
 | 
						|
#+end_src
 | 
						|
 | 
						|
We compare this transfer function with a transfer function corresponding to an ideal first order LPF with a cut-off frequency of $1060Hz$.
 | 
						|
We obtain the result on figure [[fig:Glpf_bode_bis]].
 | 
						|
#+begin_src matlab :results none
 | 
						|
  Gth = 1/(1+s/1060/2/pi);
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+begin_src matlab :results none
 | 
						|
  figure;
 | 
						|
  ax1 = subplot(2, 1, 1);
 | 
						|
  hold on;
 | 
						|
  plot(f, abs(Glpf));
 | 
						|
  plot(f, abs(squeeze(freqresp(Gth, f, 'Hz'))));
 | 
						|
  hold off;
 | 
						|
  set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
 | 
						|
  set(gca, 'XTickLabel',[]);
 | 
						|
  ylabel('Magnitude');
 | 
						|
 | 
						|
  ax2 = subplot(2, 1, 2);
 | 
						|
  hold on;
 | 
						|
  plot(f, mod(180+180/pi*phase(Glpf), 360)-180);
 | 
						|
  plot(f, 180/pi*unwrap(angle(squeeze(freqresp(Gth, f, 'Hz')))));
 | 
						|
  hold off;
 | 
						|
  set(gca, 'xscale', 'log');
 | 
						|
  ylim([-180, 180]);
 | 
						|
  yticks([-180, -90, 0, 90, 180]);
 | 
						|
  xlabel('Frequency [Hz]'); ylabel('Phase');
 | 
						|
 | 
						|
  linkaxes([ax1,ax2],'x');
 | 
						|
  xlim([1, 500]);
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:Glpf_bode_bis
 | 
						|
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
 | 
						|
#+begin_src matlab :var filepath="figs/Glpf_bode_bis.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
 | 
						|
  <<plt-matlab>>
 | 
						|
#+end_src
 | 
						|
 | 
						|
#+NAME: fig:Glpf_bode_bis
 | 
						|
#+CAPTION: Bode Diagram of the measured Low Pass filter and the theoritical one
 | 
						|
#+RESULTS: fig:Glpf_bode_bis
 | 
						|
[[file:figs/Glpf_bode_bis.png]]
 | 
						|
*** Conclusion
 | 
						|
#+begin_important
 | 
						|
  The added LPF has the expected behavior.
 | 
						|
#+end_important
 |