#+TITLE:SpeedGoat
:DRAWER:
#+STARTUP: overview
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+HTML_HEAD:
#+PROPERTY: header-args:matlab :session *MATLAB*
#+PROPERTY: header-args:matlab+ :comments org
#+PROPERTY: header-args:matlab+ :results output
#+PROPERTY: header-args:matlab+ :exports both
#+PROPERTY: header-args:matlab+ :eval no-export
#+PROPERTY: header-args:matlab+ :output-dir figs
:END:
* Setup
Two L22 geophones are used.
They are placed on the ID31 granite.
They are leveled.
The signals are amplified using voltage amplifier with a gain of 60dB.
The voltage amplifiers include a low pass filter with a cut-off frequency at 1kHz.
#+name: fig:figure_name
#+caption: Setup
#+attr_html: :width 500px
[[file:./figs/setup.jpg]]
#+name: fig:figure_name
#+caption: Geophones
#+attr_html: :width 500px
[[file:./figs/geophones.jpg]]
* Signal Processing
** Matlab Init :noexport:ignore:
#+begin_src matlab :exports none :results silent :noweb yes
<>
#+end_src
** Load data
#+begin_src matlab :results none
load('mat/data_001.mat', 't', 'x1', 'x2');
dt = t(2) - t(1);
#+end_src
** Time Domain Data
#+begin_src matlab :results none
figure;
hold on;
plot(t, x1);
plot(t, x2);
hold off;
xlabel('Time [s]');
ylabel('Voltage [V]');
xlim([t(1), t(end)]);
#+end_src
#+NAME: fig:data_time_domain
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
#+begin_src matlab :var filepath="figs/data_time_domain.pdf" :var figsize="wide-normal" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+NAME: fig:data_time_domain
#+CAPTION: Time domain Data
#+RESULTS: fig:data_time_domain
[[file:figs/data_time_domain.png]]
#+begin_src matlab :results none
figure;
hold on;
plot(t, x1);
plot(t, x2);
hold off;
xlabel('Time [s]');
ylabel('Voltage [V]');
xlim([0 1]);
#+end_src
#+NAME: fig:data_time_domain_zoom
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
#+begin_src matlab :var filepath="figs/data_time_domain_zoom.pdf" :var figsize="wide-normal" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+NAME: fig:data_time_domain_zoom
#+CAPTION: Time domain Data - Zoom
#+RESULTS: fig:data_time_domain_zoom
[[file:figs/data_time_domain_zoom.png]]
** Compute PSD
#+begin_src matlab :results none
[pxx1, f1] = pwelch(x1, hanning(ceil(1/dt)), 0, [], 1/dt);
[pxx2, f2] = pwelch(x2, hanning(ceil(1/dt)), 0, [], 1/dt);
#+end_src
** Take into account sensibility of Geophone
The Geophone used are L22.
#+begin_src matlab :results none
S0 = 88; % Sensitivity [V/(m/s)]
f0 = 2; % Cut-off frequnecy [Hz]
S = (s/2/pi/f0)/(1+s/2/pi/f0);
#+end_src
#+begin_src matlab :results none
figure;
bodeFig({S});
ylabel('Amplitude [V/(m/s)]')
#+end_src
#+NAME: fig:geophone_sensibility
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
#+begin_src matlab :var filepath="figs/geophone_sensibility.pdf" :var figsize="wide-normal" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+NAME: fig:geophone_sensibility
#+CAPTION: Sensibility of the Geophone
#+RESULTS: fig:geophone_sensibility
[[file:figs/geophone_sensibility.png]]
We take into account the gain of the electronics.
The cut-off frequency is set at 1kHz.
- [ ] Check what is the order of the filter
- [ ] Maybe I should not use this filter as there is no high frequencies anyway?
#+begin_src matlab :results none
G0 = 60; % [dB]
G = G0/(1+s/2/pi/1000);
#+end_src
#+begin_src matlab :results none
figure;
hold on;
plot(f1, sqrt(pxx1)./squeeze(abs(freqresp(G, f1, 'Hz')))./squeeze(abs(freqresp(S, f1, 'Hz'))));
plot(f2, sqrt(pxx2)./squeeze(abs(freqresp(G, f2, 'Hz')))./squeeze(abs(freqresp(S, f2, 'Hz'))));
hold off;
set(gca, 'xscale', 'log');
set(gca, 'yscale', 'log');
xlabel('Frequency [Hz]'); ylabel('PSD [m/s/sqrt(Hz)]')
xlim([2, 500]);
#+end_src
#+NAME: fig:psd_velocity
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
#+begin_src matlab :var filepath="figs/psd_velocity.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+NAME: fig:psd_velocity
#+CAPTION: Spectral density of the velocity
#+RESULTS: fig:psd_velocity
[[file:figs/psd_velocity.png]]
** Transfer function between the two geophones
#+begin_src matlab :results none
[T12, f12] = tfestimate(x1, x2, hanning(ceil(length(x1)/100)), [], [], 1/dt);
#+end_src
#+begin_src matlab :results none
figure;
ax1 = subplot(2, 1, 1);
plot(f12, abs(T12));
set(gca, 'xscale', 'log'); set(gca, 'yscale', 'log');
set(gca, 'XTickLabel',[]);
ylabel('Magnitude');
ax2 = subplot(2, 1, 2);
plot(f12, mod(180+180/pi*phase(T12), 360)-180);
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:tf_geophones
#+HEADER: :tangle no :exports results :results value raw replace :noweb yes
#+begin_src matlab :var filepath="figs/tf_geophones.pdf" :var figsize="full-tall" :post pdf2svg(file=*this*, ext="png")
<>
#+end_src
#+NAME: fig:tf_geophones
#+CAPTION: Estimated transfer function between the two geophones
#+RESULTS: fig:tf_geophones
[[file:figs/tf_geophones.png]]