#+TITLE:Static Measurements :drawer: #+STARTUP: overview #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+HTML_HEAD: #+LATEX_CLASS: cleanreport #+LaTeX_CLASS_OPTIONS: [tocnp, secbreak, minted] #+PROPERTY: header-args:shell :eval no-export #+PROPERTY: header-args:matlab :session *MATLAB* #+PROPERTY: header-args:matlab+ :comments org #+PROPERTY: header-args:matlab+ :exports both #+PROPERTY: header-args:matlab+ :eval no-export #+PROPERTY: header-args:matlab+ :noweb yes #+PROPERTY: header-args:matlab+ :mkdirp yes #+PROPERTY: header-args:matlab+ :output-dir figs :end: [[../index.org][Back to main page]]. * Notes - *5530*: Straightness Plot: Yz - *Filename*: =r:\home\PDMU\PEL\Measurement_library\ID31\ID31_u_station\TY\12_12_2018\linear deviation _tyz_401_points.txt= - *Acquisition date*: 09/01/2019 13:49:42 - *Current date*: 08/03/2019 08:46:35 - *Measurement Type*: STRAIGHTNESS vertical - *Travel Mode*: Bidirectional - *Number of Target Positions*: 401 - *Number of total data pairs*: 2406 - *Number of total data runs*:6 - *Position Value Units*: millimeters - *Error Value Units*: micrometers | Environmental Data | Min | Max | Avg | |--------------------+--------+--------+--------| | Air Temp (C) | 024,57 | 024,61 | 024,59 | | Air Prs (mm) | 742,56 | 743,29 | 742,83 | | Air Hmd (%) | 024,00 | 024,00 | 024,00 | | MT1 Temp (C) | | | 020,00 | | MT2 Temp (C) | 024,40 | 024,44 | 024,42 | | MT3 Temp (C) | 024,32 | 024,36 | 024,34 | * Data Pre-processing #+begin_src shell :results silent sed 's/\t/ /g;s/\,/./g' "data/linear deviation _tyz_401_points.txt" > data/data.txt #+end_src #+begin_src shell :exports both :post addhdr(*this*) head "data/data.txt" #+end_src #+RESULTS: | Run | Pos | TargetValue | ErrorValue | |-----+-----+-------------+---------------| | 1 | 1 | -4.5E+00 | 7.5377892E+00 | | 1 | 2 | -4.4775E+00 | 7.5422246E+00 | | 1 | 3 | -4.455E+00 | 7.5655617E+00 | | 1 | 4 | -4.4325E+00 | 7.5149518E+00 | | 1 | 5 | -4.41E+00 | 7.4886377E+00 | | 1 | 6 | -4.3875E+00 | 7.437007E+00 | | 1 | 7 | -4.365E+00 | 7.4449354E+00 | | 1 | 8 | -4.3425E+00 | 7.3937387E+00 | | 1 | 9 | -4.32E+00 | 7.3287468E+00 | * Matlab - Data Import #+begin_src matlab :results silent filename = 'data/data.txt'; fileID = fopen(filename); data = cell2mat(textscan(fileID,'%f %f %f %f', 'collectoutput', 1,'headerlines',1)); fclose(fileID); #+end_src * Data - Plot #+begin_src matlab :results silent figure; hold on; for i=1:data(end, 1) plot(data(data(:, 1) == i, 3), data(data(:, 1) == i, 4), '-k'); end hold off; xlabel('Target Value [mm]'); ylabel('Error Value [um]'); #+end_src #+NAME: fig:raw_data #+HEADER: :tangle no :exports results :results raw :noweb yes #+begin_src matlab :var filepath="figs/raw_data.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png") <> #+end_src #+NAME: fig:raw_data #+CAPTION: Time domain Data #+RESULTS: fig:raw_data [[file:figs/raw_data.png]] Compute mean value of each position #+begin_src matlab :results silent mean_pos = zeros(sum(data(:, 1)==1), 1); for i=1:sum(data(:, 1)==1) mean_pos(i) = mean(data(data(:, 2)==i, 4)); end #+end_src #+begin_src matlab :results silent figure; hold on; for i=1:data(end, 1) filt = data(:, 1) == i; plot(data(filt, 3), data(filt, 4) - mean_pos, '-k'); end hold off; xlabel('Target Value [mm]'); ylabel('Error Value [um]'); #+end_src #+NAME: fig:processed_data #+HEADER: :tangle no :exports results :results raw :noweb yes #+begin_src matlab :var filepath="figs/processed_data.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png") <> #+end_src #+NAME: fig:processed_data #+CAPTION: caption #+RESULTS: fig:processed_data [[file:figs/processed_data.png]] * Translate to time domain #+begin_src matlab :results none t = linspace(0, 1, length(data(data(:, 1)==1, 4))); #+end_src #+begin_src matlab :results none figure; hold on; plot(t, data(data(:, 1) == 1, 4) - mean_pos, '-k'); hold off; xlabel('Time [s]'); ylabel('Error Value [um]'); #+end_src #+NAME: fig:time_domain #+HEADER: :tangle no :exports results :results raw :noweb yes #+begin_src matlab :var filepath="figs/time_domain.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png") <> #+end_src #+NAME: fig:time_domain #+CAPTION: caption #+RESULTS: fig:time_domain [[file:figs/time_domain.png]] * Compute the PSD #+begin_src matlab :results none n_av = 5; Fs = 1/t(2); x = data(data(:, 1) == 1, 4) - mean_pos; [pxx, f] = pwelch(x, hanning(ceil(length(x)/n_av)), [], [], Fs); pxx_t = zeros(length(pxx), data(end, 1)); for i=1:data(end, 1) x = data(data(:, 1) == i, 4) - mean_pos; [pxx, f] = pwelch(x, hanning(ceil(length(x)/n_av)), [], [], Fs); pxx_t(:, i) = pxx; end #+end_src #+begin_src matlab :results none figure; hold on; plot(f, mean(pxx_t, 2)); hold off; xlabel('Frequency (Hz)'); ylabel('PSD ($m^2/Hz$)'); set(gca, 'XScale', 'log'); set(gca, 'YScale', 'log'); legend({'PSD - x', 'PSD - y', 'PSD - z'}); #+end_src #+NAME: fig:psd #+HEADER: :tangle no :exports results :results raw :noweb yes #+begin_src matlab :var filepath="figs/psd.pdf" :var figsize="wide-tall" :post pdf2svg(file=*this*, ext="png") <> #+end_src #+NAME: fig:psd #+CAPTION: PSD of the Z motion when scanning with Ty at 1Hz #+RESULTS: fig:psd [[file:figs/psd.png]]