<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<!-- 2019-03-20 mer. 15:17 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Spindle Analysis</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Thomas Dehaeze" />
<style type="text/css">
 <!--/*--><![CDATA[/*><!--*/
  .title  { text-align: center;
             margin-bottom: .2em; }
  .subtitle { text-align: center;
              font-size: medium;
              font-weight: bold;
              margin-top:0; }
  .todo   { font-family: monospace; color: red; }
  .done   { font-family: monospace; color: green; }
  .priority { font-family: monospace; color: orange; }
  .tag    { background-color: #eee; font-family: monospace;
            padding: 2px; font-size: 80%; font-weight: normal; }
  .timestamp { color: #bebebe; }
  .timestamp-kwd { color: #5f9ea0; }
  .org-right  { margin-left: auto; margin-right: 0px;  text-align: right; }
  .org-left   { margin-left: 0px;  margin-right: auto; text-align: left; }
  .org-center { margin-left: auto; margin-right: auto; text-align: center; }
  .underline { text-decoration: underline; }
  #postamble p, #preamble p { font-size: 90%; margin: .2em; }
  p.verse { margin-left: 3%; }
  pre {
    border: 1px solid #ccc;
    box-shadow: 3px 3px 3px #eee;
    padding: 8pt;
    font-family: monospace;
    overflow: auto;
    margin: 1.2em;
  }
  pre.src {
    position: relative;
    overflow: visible;
    padding-top: 1.2em;
  }
  pre.src:before {
    display: none;
    position: absolute;
    background-color: white;
    top: -10px;
    right: 10px;
    padding: 3px;
    border: 1px solid black;
  }
  pre.src:hover:before { display: inline;}
  /* Languages per Org manual */
  pre.src-asymptote:before { content: 'Asymptote'; }
  pre.src-awk:before { content: 'Awk'; }
  pre.src-C:before { content: 'C'; }
  /* pre.src-C++ doesn't work in CSS */
  pre.src-clojure:before { content: 'Clojure'; }
  pre.src-css:before { content: 'CSS'; }
  pre.src-D:before { content: 'D'; }
  pre.src-ditaa:before { content: 'ditaa'; }
  pre.src-dot:before { content: 'Graphviz'; }
  pre.src-calc:before { content: 'Emacs Calc'; }
  pre.src-emacs-lisp:before { content: 'Emacs Lisp'; }
  pre.src-fortran:before { content: 'Fortran'; }
  pre.src-gnuplot:before { content: 'gnuplot'; }
  pre.src-haskell:before { content: 'Haskell'; }
  pre.src-hledger:before { content: 'hledger'; }
  pre.src-java:before { content: 'Java'; }
  pre.src-js:before { content: 'Javascript'; }
  pre.src-latex:before { content: 'LaTeX'; }
  pre.src-ledger:before { content: 'Ledger'; }
  pre.src-lisp:before { content: 'Lisp'; }
  pre.src-lilypond:before { content: 'Lilypond'; }
  pre.src-lua:before { content: 'Lua'; }
  pre.src-matlab:before { content: 'MATLAB'; }
  pre.src-mscgen:before { content: 'Mscgen'; }
  pre.src-ocaml:before { content: 'Objective Caml'; }
  pre.src-octave:before { content: 'Octave'; }
  pre.src-org:before { content: 'Org mode'; }
  pre.src-oz:before { content: 'OZ'; }
  pre.src-plantuml:before { content: 'Plantuml'; }
  pre.src-processing:before { content: 'Processing.js'; }
  pre.src-python:before { content: 'Python'; }
  pre.src-R:before { content: 'R'; }
  pre.src-ruby:before { content: 'Ruby'; }
  pre.src-sass:before { content: 'Sass'; }
  pre.src-scheme:before { content: 'Scheme'; }
  pre.src-screen:before { content: 'Gnu Screen'; }
  pre.src-sed:before { content: 'Sed'; }
  pre.src-sh:before { content: 'shell'; }
  pre.src-sql:before { content: 'SQL'; }
  pre.src-sqlite:before { content: 'SQLite'; }
  /* additional languages in org.el's org-babel-load-languages alist */
  pre.src-forth:before { content: 'Forth'; }
  pre.src-io:before { content: 'IO'; }
  pre.src-J:before { content: 'J'; }
  pre.src-makefile:before { content: 'Makefile'; }
  pre.src-maxima:before { content: 'Maxima'; }
  pre.src-perl:before { content: 'Perl'; }
  pre.src-picolisp:before { content: 'Pico Lisp'; }
  pre.src-scala:before { content: 'Scala'; }
  pre.src-shell:before { content: 'Shell Script'; }
  pre.src-ebnf2ps:before { content: 'ebfn2ps'; }
  /* additional language identifiers per "defun org-babel-execute"
       in ob-*.el */
  pre.src-cpp:before  { content: 'C++'; }
  pre.src-abc:before  { content: 'ABC'; }
  pre.src-coq:before  { content: 'Coq'; }
  pre.src-groovy:before  { content: 'Groovy'; }
  /* additional language identifiers from org-babel-shell-names in
     ob-shell.el: ob-shell is the only babel language using a lambda to put
     the execution function name together. */
  pre.src-bash:before  { content: 'bash'; }
  pre.src-csh:before  { content: 'csh'; }
  pre.src-ash:before  { content: 'ash'; }
  pre.src-dash:before  { content: 'dash'; }
  pre.src-ksh:before  { content: 'ksh'; }
  pre.src-mksh:before  { content: 'mksh'; }
  pre.src-posh:before  { content: 'posh'; }
  /* Additional Emacs modes also supported by the LaTeX listings package */
  pre.src-ada:before { content: 'Ada'; }
  pre.src-asm:before { content: 'Assembler'; }
  pre.src-caml:before { content: 'Caml'; }
  pre.src-delphi:before { content: 'Delphi'; }
  pre.src-html:before { content: 'HTML'; }
  pre.src-idl:before { content: 'IDL'; }
  pre.src-mercury:before { content: 'Mercury'; }
  pre.src-metapost:before { content: 'MetaPost'; }
  pre.src-modula-2:before { content: 'Modula-2'; }
  pre.src-pascal:before { content: 'Pascal'; }
  pre.src-ps:before { content: 'PostScript'; }
  pre.src-prolog:before { content: 'Prolog'; }
  pre.src-simula:before { content: 'Simula'; }
  pre.src-tcl:before { content: 'tcl'; }
  pre.src-tex:before { content: 'TeX'; }
  pre.src-plain-tex:before { content: 'Plain TeX'; }
  pre.src-verilog:before { content: 'Verilog'; }
  pre.src-vhdl:before { content: 'VHDL'; }
  pre.src-xml:before { content: 'XML'; }
  pre.src-nxml:before { content: 'XML'; }
  /* add a generic configuration mode; LaTeX export needs an additional
     (add-to-list 'org-latex-listings-langs '(conf " ")) in .emacs */
  pre.src-conf:before { content: 'Configuration File'; }

  table { border-collapse:collapse; }
  caption.t-above { caption-side: top; }
  caption.t-bottom { caption-side: bottom; }
  td, th { vertical-align:top;  }
  th.org-right  { text-align: center;  }
  th.org-left   { text-align: center;   }
  th.org-center { text-align: center; }
  td.org-right  { text-align: right;  }
  td.org-left   { text-align: left;   }
  td.org-center { text-align: center; }
  dt { font-weight: bold; }
  .footpara { display: inline; }
  .footdef  { margin-bottom: 1em; }
  .figure { padding: 1em; }
  .figure p { text-align: center; }
  .equation-container {
    display: table;
    text-align: center;
    width: 100%;
  }
  .equation {
    vertical-align: middle;
  }
  .equation-label {
    display: table-cell;
    text-align: right;
    vertical-align: middle;
  }
  .inlinetask {
    padding: 10px;
    border: 2px solid gray;
    margin: 10px;
    background: #ffffcc;
  }
  #org-div-home-and-up
   { text-align: right; font-size: 70%; white-space: nowrap; }
  textarea { overflow-x: auto; }
  .linenr { font-size: smaller }
  .code-highlighted { background-color: #ffff00; }
  .org-info-js_info-navigation { border-style: none; }
  #org-info-js_console-label
    { font-size: 10px; font-weight: bold; white-space: nowrap; }
  .org-info-js_search-highlight
    { background-color: #ffff00; color: #000000; font-weight: bold; }
  .org-svg { width: 90%; }
  /*]]>*/-->
</style>
<link rel="stylesheet" type="text/css" href="../css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="../css/readtheorg.css"/>
<script src="../js/jquery.min.js"></script>
<script src="../js/bootstrap.min.js"></script>
<script src="../js/jquery.stickytableheaders.min.js"></script>
<script src="../js/readtheorg.js"></script>
<script type="text/javascript">
/*
@licstart  The following is the entire license notice for the
JavaScript code in this tag.

Copyright (C) 2012-2019 Free Software Foundation, Inc.

The JavaScript code in this tag is free software: you can
redistribute it and/or modify it under the terms of the GNU
General Public License (GNU GPL) as published by the Free Software
Foundation, either version 3 of the License, or (at your option)
any later version.  The code is distributed WITHOUT ANY WARRANTY;
without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE.  See the GNU GPL for more details.

As additional permission under GNU GPL version 3 section 7, you
may distribute non-source (e.g., minimized or compacted) forms of
that code without the copy of the GNU GPL normally required by
section 4, provided you include this license notice and a URL
through which recipients can access the Corresponding Source.


@licend  The above is the entire license notice
for the JavaScript code in this tag.
*/
<!--/*--><![CDATA[/*><!--*/
 function CodeHighlightOn(elem, id)
 {
   var target = document.getElementById(id);
   if(null != target) {
     elem.cacheClassElem = elem.className;
     elem.cacheClassTarget = target.className;
     target.className = "code-highlighted";
     elem.className   = "code-highlighted";
   }
 }
 function CodeHighlightOff(elem, id)
 {
   var target = document.getElementById(id);
   if(elem.cacheClassElem)
     elem.className = elem.cacheClassElem;
   if(elem.cacheClassTarget)
     target.className = elem.cacheClassTarget;
 }
/*]]>*///-->
</script>
<script type="text/x-mathjax-config">
    MathJax.Hub.Config({
        displayAlign: "center",
        displayIndent: "0em",

        "HTML-CSS": { scale: 100,
                        linebreaks: { automatic: "false" },
                        webFont: "TeX"
                       },
        SVG: {scale: 100,
              linebreaks: { automatic: "false" },
              font: "TeX"},
        NativeMML: {scale: 100},
        TeX: { equationNumbers: {autoNumber: "AMS"},
               MultLineWidth: "85%",
               TagSide: "right",
               TagIndent: ".8em"
             }
});
</script>
<script type="text/javascript"
        src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.0/MathJax.js?config=TeX-AMS_HTML"></script>
</head>
<body>
<div id="content">
<h1 class="title">Spindle Analysis</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#org4ef1ca3">1. Notes</a></li>
<li><a href="#orge92ef42">2. Data Processing</a>
<ul>
<li><a href="#orgbf2f91a">2.1. Load Measurement Data</a></li>
<li><a href="#orge799cbd">2.2. Convert Signals from [deg] to [sec]</a></li>
<li><a href="#orge0e840d">2.3. Convert Signals</a></li>
<li><a href="#orgb79c23f">2.4. Ts and Fs for both measurements</a></li>
<li><a href="#org545b4dc">2.5. Find Noise of the ADC [m/sqrt(Hz)]</a></li>
<li><a href="#orgb7c25b7">2.6. Save all the data under spindle struct</a></li>
<li><a href="#org707a6a0">2.7. Compute Asynchronous data</a></li>
</ul>
</li>
<li><a href="#orga9ae55f">3. Time Domain Data</a>
<ul>
<li><a href="#orga3598c8">3.1. Plot X-Y-Z position with respect to Time - 1rpm</a></li>
<li><a href="#orgb1d7825">3.2. Plot X-Y-Z position with respect to Time - 60rpm</a></li>
<li><a href="#org487e41f">3.3. Plot Synchronous and Asynchronous - 1rpm</a></li>
<li><a href="#org5310667">3.4. Plot Synchronous and Asynchronous - 60rpm</a></li>
<li><a href="#org037b157">3.5. Plot X against Y</a></li>
<li><a href="#org067dc56">3.6. Plot X against Y - Asynchronous</a></li>
</ul>
</li>
<li><a href="#org590c4a3">4. Model of the spindle</a>
<ul>
<li><a href="#orgb7ea4e3">4.1. Parameters</a></li>
<li><a href="#orge4e720c">4.2. Compute Mass and Stiffness Matrices</a></li>
<li><a href="#org5d5795f">4.3. Compute resonance frequencies</a></li>
<li><a href="#org2f89d7b">4.4. From model<sub>damping</sub> compute the Damping Matrix</a></li>
<li><a href="#org31812e9">4.5. Define inputs, outputs and state names</a></li>
<li><a href="#org931a108">4.6. Define A, B and C matrices</a></li>
<li><a href="#org6246054">4.7. Generate the State Space Model</a></li>
<li><a href="#orgfed5d4b">4.8. Bode Plot</a></li>
</ul>
</li>
<li><a href="#org90551c6">5. Power Spectral Density</a>
<ul>
<li><a href="#org659372f">5.1. Compute the PSD</a></li>
<li><a href="#org3690c18">5.2. Plot the computed PSD</a></li>
<li><a href="#org0a6959c">5.3. Load the model of the spindle</a></li>
<li><a href="#orgb977795">5.4. Plot the PSD of the Force using the model</a></li>
<li><a href="#orgbd81578">5.5. Estimated Shape of the PSD of the force</a></li>
<li><a href="#orgebea7be">5.6. PSD in [N]</a></li>
<li><a href="#org4818470">5.7. PSD in [m]</a></li>
<li><a href="#org408aad1">5.8. Compute the resulting RMS value [m]</a></li>
<li><a href="#org97cda8b">5.9. Compute the resulting RMS value [m]</a></li>
</ul>
</li>
<li><a href="#orgb0ca16b">6. Functions</a>
<ul>
<li><a href="#org14006e0">6.1. getAsynchronousError</a></li>
</ul>
</li>
</ul>
</div>
</div>

<p>
<a href="../index.html">Back to main page</a>.
</p>

<p>
The report made by the PEL is accessible <a href="documents/Spindle_report_test.pdf">here</a>.
</p>

<div id="outline-container-org4ef1ca3" class="outline-2">
<h2 id="org4ef1ca3"><span class="section-number-2">1</span> Notes</h2>
<div class="outline-text-2" id="text-1">

<div id="org4241ebb" class="figure">
<p><img src="./figs/setup_spindle.png" alt="setup_spindle.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Measurement setup at the PEL lab</p>
</div>
</div>
</div>

<div id="outline-container-orge92ef42" class="outline-2">
<h2 id="orge92ef42"><span class="section-number-2">2</span> Data Processing</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-orgbf2f91a" class="outline-3">
<h3 id="orgbf2f91a"><span class="section-number-3">2.1</span> Load Measurement Data</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-matlab">spindle_1rpm_table  = readtable<span style="color: #DCDCCC;">(</span>'<span style="color: #7CB8BB;">./</span>data<span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">10turns_1rpm_icepap</span>.txt'<span style="color: #DCDCCC;">)</span>;
spindle_60rpm_table = readtable<span style="color: #DCDCCC;">(</span>'<span style="color: #7CB8BB;">./</span>data<span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">10turns_60rpm_IcepapFIR</span>.txt'<span style="color: #DCDCCC;">)</span>;
</pre>
</div>

<div class="org-src-container">
<pre class="src src-matlab">spindle_1rpm_table<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span>, <span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">)</span>
</pre>
</div>

<div class="org-src-container">
<pre class="src src-matlab">spindle_1rpm  = table2array<span style="color: #DCDCCC;">(</span>spindle_1rpm_table<span style="color: #DCDCCC;">)</span>;
spindle_60rpm = table2array<span style="color: #DCDCCC;">(</span>spindle_60rpm_table<span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-orge799cbd" class="outline-3">
<h3 id="orge799cbd"><span class="section-number-3">2.2</span> Convert Signals from [deg] to [sec]</h3>
<div class="outline-text-3" id="text-2-2">
<div class="org-src-container">
<pre class="src src-matlab">speed_1rpm = <span style="color: #BFEBBF;">360</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">60</span>; <span style="color: #7F9F7F;">% [deg/sec]</span>
spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span> = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span>speed_1rpm;  <span style="color: #7F9F7F;">% From position [deg] to time [s]</span>

speed_60rpm = <span style="color: #BFEBBF;">360</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">1</span>; <span style="color: #7F9F7F;">% [deg/sec]</span>
spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span> = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span>speed_60rpm; <span style="color: #7F9F7F;">% From position [deg] to time [s]</span>
</pre>
</div>
</div>
</div>

<div id="outline-container-orge0e840d" class="outline-3">
<h3 id="orge0e840d"><span class="section-number-3">2.3</span> Convert Signals</h3>
<div class="outline-text-3" id="text-2-3">
<div class="org-src-container">
<pre class="src src-matlab">% scaling = <span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">80000</span>; % <span style="color: #BFEBBF;">80</span> mV<span style="color: #7CB8BB;">/</span>um
scaling = <span style="color: #BFEBBF;">1e</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">6</span>; <span style="color: #7F9F7F;">% [um] to [m]</span>

spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span> = scaling<span style="color: #7CB8BB;">*</span>spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% [V] to [m]</span>
spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span> = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">-</span>mean<span style="color: #DCDCCC;">(</span>spindle_1rpm<span style="color: #BFEBBF;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Remove mean</span>

spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span> = scaling<span style="color: #7CB8BB;">*</span>spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% [V] to [m]</span>
spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span> = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">-</span>mean<span style="color: #DCDCCC;">(</span>spindle_60rpm<span style="color: #BFEBBF;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">:</span>end<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>; <span style="color: #7F9F7F;">% Remove mean</span>
</pre>
</div>
</div>
</div>

<div id="outline-container-orgb79c23f" class="outline-3">
<h3 id="orgb79c23f"><span class="section-number-3">2.4</span> Ts and Fs for both measurements</h3>
<div class="outline-text-3" id="text-2-4">
<div class="org-src-container">
<pre class="src src-matlab">Ts_1rpm = spindle_1rpm<span style="color: #DCDCCC;">(</span>end, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #DCDCCC;">(</span>length<span style="color: #BFEBBF;">(</span>spindle_1rpm<span style="color: #D0BF8F;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>;
Fs_1rpm = <span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">/</span>Ts_1rpm;

Ts_60rpm = spindle_60rpm<span style="color: #DCDCCC;">(</span>end, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #DCDCCC;">(</span>length<span style="color: #BFEBBF;">(</span>spindle_60rpm<span style="color: #D0BF8F;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>;
Fs_60rpm = <span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">/</span>Ts_60rpm;
</pre>
</div>
</div>
</div>

<div id="outline-container-org545b4dc" class="outline-3">
<h3 id="org545b4dc"><span class="section-number-3">2.5</span> Find Noise of the ADC [m/sqrt(Hz)]</h3>
<div class="outline-text-3" id="text-2-5">
<div class="org-src-container">
<pre class="src src-matlab">data = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">)</span>;
dV_1rpm = min<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>data<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">)</span> <span style="color: #7CB8BB;">-</span> data<span style="color: #D0BF8F;">(</span>data <span style="color: #7CB8BB;">~=</span> data<span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #93E0E3;">)</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
noise_1rpm = dV_1rpm<span style="color: #7CB8BB;">/</span>sqrt<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">12</span><span style="color: #7CB8BB;">*</span>Fs_1rpm<span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span>;

data = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">)</span>;
dV_60rpm = min<span style="color: #DCDCCC;">(</span>abs<span style="color: #BFEBBF;">(</span>data<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">50</span><span style="color: #D0BF8F;">)</span> <span style="color: #7CB8BB;">-</span> data<span style="color: #D0BF8F;">(</span>data <span style="color: #7CB8BB;">~=</span> data<span style="color: #93E0E3;">(</span><span style="color: #BFEBBF;">50</span><span style="color: #93E0E3;">)</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
noise_60rpm = dV_60rpm<span style="color: #7CB8BB;">/</span>sqrt<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">12</span><span style="color: #7CB8BB;">*</span>Fs_60rpm<span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-orgb7c25b7" class="outline-3">
<h3 id="orgb7c25b7"><span class="section-number-3">2.6</span> Save all the data under spindle struct</h3>
<div class="outline-text-3" id="text-2-6">
<div class="org-src-container">
<pre class="src src-matlab">spindle.rpm1.time = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm1.deg  = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm1.Ts   = Ts_1rpm;
spindle.rpm1.Fs   = <span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">/</span>Ts_1rpm;
spindle.rpm1.x    = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm1.y    = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">4</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm1.z    = spindle_1rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm1.adcn = noise_1rpm;

spindle.rpm60.time = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm60.deg  = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm60.Ts   = Ts_60rpm;
spindle.rpm60.Fs   = <span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">/</span>Ts_60rpm;
spindle.rpm60.x    = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">3</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm60.y    = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">4</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm60.z    = spindle_60rpm<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">:</span>, <span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">)</span>;
spindle.rpm60.adcn = noise_60rpm;
</pre>
</div>
</div>
</div>

<div id="outline-container-org707a6a0" class="outline-3">
<h3 id="org707a6a0"><span class="section-number-3">2.7</span> Compute Asynchronous data</h3>
<div class="outline-text-3" id="text-2-7">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">for</span> <span style="color: #DFAF8F;">direction</span> = <span style="color: #DCDCCC;">{</span><span style="color: #CC9393;">'x'</span><span style="color: #CC9393;">, 'y', 'z'</span><span style="color: #DCDCCC;">}</span>
    spindle.rpm1.<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>direction<span style="color: #D0BF8F;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">}</span>, <span style="color: #CC9393;">'async'</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span> = getAsynchronousError<span style="color: #DCDCCC;">(</span>spindle.rpm1.<span style="color: #BFEBBF;">(</span>direction<span style="color: #D0BF8F;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">10</span><span style="color: #DCDCCC;">)</span>;
    spindle.rpm60.<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>direction<span style="color: #D0BF8F;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">}</span>, <span style="color: #CC9393;">'async'</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span> = getAsynchronousError<span style="color: #DCDCCC;">(</span>spindle.rpm60.<span style="color: #BFEBBF;">(</span>direction<span style="color: #D0BF8F;">{</span><span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">10</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
</div>

<div id="outline-container-orga9ae55f" class="outline-2">
<h2 id="orga9ae55f"><span class="section-number-2">3</span> Time Domain Data</h2>
<div class="outline-text-2" id="text-3">
</div>
<div id="outline-container-orga3598c8" class="outline-3">
<h3 id="orga3598c8"><span class="section-number-3">3.1</span> Plot X-Y-Z position with respect to Time - 1rpm</h3>
<div class="outline-text-3" id="text-3-1">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm1.time, spindle.rpm1.x<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm1.time, spindle.rpm1.y<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm1.time, spindle.rpm1.z<span style="color: #DCDCCC;">)</span>;
hold off;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Time </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">s</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">{</span>'tx <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span>', 'ty <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span>', 'tz <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span>'<span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="org4532134" class="figure">
<p><img src="figs/spindle_xyz_1rpm.png" alt="spindle_xyz_1rpm.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Raw time domain translation - 1rpm</p>
</div>
</div>
</div>

<div id="outline-container-orgb1d7825" class="outline-3">
<h3 id="orgb1d7825"><span class="section-number-3">3.2</span> Plot X-Y-Z position with respect to Time - 60rpm</h3>
<div class="outline-text-3" id="text-3-2">
<p>
The measurements for the spindle turning at 60rpm are shown figure <a href="#org624ade7">3</a>.
</p>

<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm60.time, spindle.rpm60.x<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm60.time, spindle.rpm60.y<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm60.time, spindle.rpm60.z<span style="color: #DCDCCC;">)</span>;
hold off;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Time </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">s</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">{</span>'tx <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span>', 'ty <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span>', 'tz <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span>'<span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="org624ade7" class="figure">
<p><img src="figs/spindle_xyz_60rpm.png" alt="spindle_xyz_60rpm.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Raw time domain translation - 60rpm</p>
</div>
</div>
</div>

<div id="outline-container-org487e41f" class="outline-3">
<h3 id="org487e41f"><span class="section-number-3">3.3</span> Plot Synchronous and Asynchronous - 1rpm</h3>
<div class="outline-text-3" id="text-3-3">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm1.time, spindle.rpm1.x<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm1.time, spindle.rpm1.xasync<span style="color: #DCDCCC;">)</span>;
hold off;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Time </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">s</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">{</span>'tx <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span> <span style="color: #7CB8BB;">-</span> Sync', 'tx <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span> <span style="color: #7CB8BB;">-</span> Async'<span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="orgaccc4b0" class="figure">
<p><img src="figs/spindle_1rpm_sync_async.png" alt="spindle_1rpm_sync_async.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Comparison of the synchronous and asynchronous displacements - 1rpm</p>
</div>
</div>
</div>

<div id="outline-container-org5310667" class="outline-3">
<h3 id="org5310667"><span class="section-number-3">3.4</span> Plot Synchronous and Asynchronous - 60rpm</h3>
<div class="outline-text-3" id="text-3-4">
<p>
The data is split into its Synchronous and Asynchronous part (figure <a href="#orgdc342a6">5</a>). We then use the Asynchronous part for the analysis in the following sections as we suppose that we can deal with the synchronous part with feedforward control.
</p>

<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm60.time, spindle.rpm60.x<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm60.time, spindle.rpm60.xasync<span style="color: #DCDCCC;">)</span>;
hold off;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Time </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">s</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">{</span>'tx <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span> <span style="color: #7CB8BB;">-</span> Sync', 'tx <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span> <span style="color: #7CB8BB;">-</span> Async'<span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="orgdc342a6" class="figure">
<p><img src="figs/spindle_60rpm_sync_async.png" alt="spindle_60rpm_sync_async.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Comparison of the synchronous and asynchronous displacements - 60rpm</p>
</div>
</div>
</div>

<div id="outline-container-org037b157" class="outline-3">
<h3 id="org037b157"><span class="section-number-3">3.5</span> Plot X against Y</h3>
<div class="outline-text-3" id="text-3-5">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm1.x, spindle.rpm1.y<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm60.x, spindle.rpm60.y<span style="color: #DCDCCC;">)</span>;
hold off;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'X Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Y Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">{</span>'<span style="color: #BFEBBF;">1rpm</span>', '<span style="color: #BFEBBF;">60rpm</span>'<span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="org6fbaabf" class="figure">
<p><img src="figs/spindle_xy_1_60rpm.png" alt="spindle_xy_1_60rpm.png" />
</p>
<p><span class="figure-number">Figure 6: </span>Synchronous x-y displacement</p>
</div>
</div>
</div>

<div id="outline-container-org067dc56" class="outline-3">
<h3 id="org067dc56"><span class="section-number-3">3.6</span> Plot X against Y - Asynchronous</h3>
<div class="outline-text-3" id="text-3-6">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm1.xasync, spindle.rpm1.yasync<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>spindle.rpm60.xasync, spindle.rpm60.yasync<span style="color: #DCDCCC;">)</span>;
hold off;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'X Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Y Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">{</span>'<span style="color: #BFEBBF;">1rpm</span>', '<span style="color: #BFEBBF;">60rpm</span>'<span style="color: #BFEBBF;">}</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="org2cad174" class="figure">
<p><img src="figs/spindle_xy_1_60_rpm_async.png" alt="spindle_xy_1_60_rpm_async.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Asynchronous x-y displacement</p>
</div>
</div>
</div>
</div>

<div id="outline-container-org590c4a3" class="outline-2">
<h2 id="org590c4a3"><span class="section-number-2">4</span> Model of the spindle</h2>
<div class="outline-text-2" id="text-4">
<p>
The model of the spindle used is shown figure <a href="#org5077262">8</a>.
</p>

<p>
\(f\) is the perturbation force of the spindle and \(d\) is the measured displacement.
</p>


<div id="org5077262" class="figure">
<p><img src="./figs/uniaxial-model-spindle.png" alt="uniaxial-model-spindle.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Model of the Spindle</p>
</div>
</div>

<div id="outline-container-orgb7ea4e3" class="outline-3">
<h3 id="orgb7ea4e3"><span class="section-number-3">4.1</span> Parameters</h3>
<div class="outline-text-3" id="text-4-1">
<div class="org-src-container">
<pre class="src src-matlab">mg = <span style="color: #BFEBBF;">3000</span>; <span style="color: #7F9F7F;">% Mass of granite [kg]</span>
ms = <span style="color: #BFEBBF;">50</span>;   <span style="color: #7F9F7F;">% Mass of Spindle [kg]</span>

kg = <span style="color: #BFEBBF;">1e8</span>; <span style="color: #7F9F7F;">% Stiffness of granite [N/m]</span>
ks = <span style="color: #BFEBBF;">5e7</span>; <span style="color: #7F9F7F;">% Stiffness of spindle [N/m]</span>
</pre>
</div>
</div>
</div>

<div id="outline-container-orge4e720c" class="outline-3">
<h3 id="orge4e720c"><span class="section-number-3">4.2</span> Compute Mass and Stiffness Matrices</h3>
<div class="outline-text-3" id="text-4-2">
<div class="org-src-container">
<pre class="src src-matlab">Mm = diag<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>ms, mg<span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
Km = diag<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>ks, ks<span style="color: #7CB8BB;">+</span>kg<span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span> <span style="color: #7CB8BB;">-</span> diag<span style="color: #DCDCCC;">(</span>ks, <span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span> <span style="color: #7CB8BB;">-</span> diag<span style="color: #DCDCCC;">(</span>ks, <span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-org5d5795f" class="outline-3">
<h3 id="org5d5795f"><span class="section-number-3">4.3</span> Compute resonance frequencies</h3>
<div class="outline-text-3" id="text-4-3">
<div class="org-src-container">
<pre class="src src-matlab">A = <span style="color: #DCDCCC;">[</span>zeros<span style="color: #BFEBBF;">(</span>size<span style="color: #D0BF8F;">(</span>Mm<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span> eye<span style="color: #BFEBBF;">(</span>size<span style="color: #D0BF8F;">(</span>Mm<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span> ; <span style="color: #7CB8BB;">-</span>Mm<span style="color: #7CB8BB;">\</span>Km zeros<span style="color: #BFEBBF;">(</span>size<span style="color: #D0BF8F;">(</span>Mm<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">]</span>;
eigA = imag<span style="color: #DCDCCC;">(</span>eigs<span style="color: #BFEBBF;">(</span>A<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">pi</span>;
eigA = eigA<span style="color: #DCDCCC;">(</span>eigA<span style="color: #7CB8BB;">&gt;</span><span style="color: #BFEBBF;">0</span><span style="color: #DCDCCC;">)</span>;
eigA = eigA<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">:</span><span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-org2f89d7b" class="outline-3">
<h3 id="org2f89d7b"><span class="section-number-3">4.4</span> From model<sub>damping</sub> compute the Damping Matrix</h3>
<div class="outline-text-3" id="text-4-4">
<div class="org-src-container">
<pre class="src src-matlab">modal_damping = <span style="color: #BFEBBF;">1e</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">5</span>;

ab = <span style="color: #DCDCCC;">[</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span><span style="color: #7CB8BB;">*</span>eigA<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span><span style="color: #7CB8BB;">/</span>eigA<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span> ; <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span><span style="color: #7CB8BB;">*</span>eigA<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span> <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span><span style="color: #7CB8BB;">/</span>eigA<span style="color: #BFEBBF;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">]</span><span style="color: #7CB8BB;">\</span><span style="color: #DCDCCC;">[</span>modal_damping ; modal_damping<span style="color: #DCDCCC;">]</span>;

Cm = ab<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">*</span>Mm <span style="color: #7CB8BB;">+</span>ab<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">*</span>Km;
</pre>
</div>
</div>
</div>

<div id="outline-container-org31812e9" class="outline-3">
<h3 id="org31812e9"><span class="section-number-3">4.5</span> Define inputs, outputs and state names</h3>
<div class="outline-text-3" id="text-4-5">
<div class="org-src-container">
<pre class="src src-matlab">StateName = <span style="color: #DCDCCC;">{</span><span style="text-decoration: underline;">...</span>
    <span style="color: #CC9393;">'xs'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Displacement of Spindle [m]</span>
    <span style="color: #CC9393;">'xg'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Displacement of Granite [m]</span>
    <span style="color: #CC9393;">'vs'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Velocity of Spindle [m]</span>
    <span style="color: #CC9393;">'vg'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Velocity of Granite [m]</span>
            <span style="color: #DCDCCC;">}</span>;
StateUnit = <span style="color: #DCDCCC;">{</span><span style="color: #CC9393;">'m', 'm', 'm/s', 'm/s'</span><span style="color: #DCDCCC;">}</span>;

InputName = <span style="color: #DCDCCC;">{</span><span style="text-decoration: underline;">...</span>
    <span style="color: #CC9393;">'f'</span> <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Spindle Force [N]</span>
            <span style="color: #DCDCCC;">}</span>;
InputUnit = <span style="color: #DCDCCC;">{</span><span style="color: #CC9393;">'N'</span><span style="color: #DCDCCC;">}</span>;

OutputName = <span style="color: #DCDCCC;">{</span><span style="text-decoration: underline;">...</span>
    <span style="color: #CC9393;">'d'</span> <span style="text-decoration: underline;">...</span> <span style="color: #7F9F7F;">% Displacement [m]</span>
             <span style="color: #DCDCCC;">}</span>;
OutputUnit = <span style="color: #DCDCCC;">{</span><span style="color: #CC9393;">'m'</span><span style="color: #DCDCCC;">}</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-org931a108" class="outline-3">
<h3 id="org931a108"><span class="section-number-3">4.6</span> Define A, B and C matrices</h3>
<div class="outline-text-3" id="text-4-6">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7F9F7F;">% A Matrix</span>
A = <span style="color: #DCDCCC;">[</span>zeros<span style="color: #BFEBBF;">(</span>size<span style="color: #D0BF8F;">(</span>Mm<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span> eye<span style="color: #BFEBBF;">(</span>size<span style="color: #D0BF8F;">(</span>Mm<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span> ; <span style="text-decoration: underline;">...</span>
     <span style="color: #7CB8BB;">-</span>Mm<span style="color: #7CB8BB;">\</span>Km          <span style="color: #7CB8BB;">-</span>Mm<span style="color: #7CB8BB;">\</span>Cm<span style="color: #DCDCCC;">]</span>;

<span style="color: #7F9F7F;">% B Matrix</span>
B_low = zeros<span style="color: #DCDCCC;">(</span>length<span style="color: #BFEBBF;">(</span>StateName<span style="color: #BFEBBF;">)</span>, length<span style="color: #BFEBBF;">(</span>InputName<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
B_low<span style="color: #DCDCCC;">(</span>strcmp<span style="color: #BFEBBF;">(</span>StateName,<span style="color: #CC9393;">'vs'</span><span style="color: #BFEBBF;">)</span><span style="color: #CC9393;">, strcmp</span><span style="color: #BFEBBF;">(</span><span style="color: #CC9393;">InputName,'f'</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span> =  <span style="color: #BFEBBF;">1</span>;
B_low<span style="color: #DCDCCC;">(</span>strcmp<span style="color: #BFEBBF;">(</span>StateName,<span style="color: #CC9393;">'vg'</span><span style="color: #BFEBBF;">)</span><span style="color: #CC9393;">, strcmp</span><span style="color: #BFEBBF;">(</span><span style="color: #CC9393;">InputName,'f'</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span> = <span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span>;
B = blkdiag<span style="color: #DCDCCC;">(</span>zeros<span style="color: #BFEBBF;">(</span>length<span style="color: #D0BF8F;">(</span>StateName<span style="color: #D0BF8F;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span><span style="color: #BFEBBF;">)</span>, pinv<span style="color: #BFEBBF;">(</span>Mm<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">*</span>B_low;

<span style="color: #7F9F7F;">% C Matrix</span>
C = zeros<span style="color: #DCDCCC;">(</span>length<span style="color: #BFEBBF;">(</span>OutputName<span style="color: #BFEBBF;">)</span>, length<span style="color: #BFEBBF;">(</span>StateName<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
C<span style="color: #DCDCCC;">(</span>strcmp<span style="color: #BFEBBF;">(</span>OutputName,<span style="color: #CC9393;">'d'</span><span style="color: #BFEBBF;">)</span><span style="color: #CC9393;">, strcmp</span><span style="color: #BFEBBF;">(</span><span style="color: #CC9393;">StateName,'xs'</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span> =  <span style="color: #BFEBBF;">1</span>;
C<span style="color: #DCDCCC;">(</span>strcmp<span style="color: #BFEBBF;">(</span>OutputName,<span style="color: #CC9393;">'d'</span><span style="color: #BFEBBF;">)</span><span style="color: #CC9393;">, strcmp</span><span style="color: #BFEBBF;">(</span><span style="color: #CC9393;">StateName,'xg'</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span> = <span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span>;

<span style="color: #7F9F7F;">% D Matrix</span>
D = zeros<span style="color: #DCDCCC;">(</span>length<span style="color: #BFEBBF;">(</span>OutputName<span style="color: #BFEBBF;">)</span>, length<span style="color: #BFEBBF;">(</span>InputName<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-org6246054" class="outline-3">
<h3 id="org6246054"><span class="section-number-3">4.7</span> Generate the State Space Model</h3>
<div class="outline-text-3" id="text-4-7">
<div class="org-src-container">
<pre class="src src-matlab">sys = ss<span style="color: #DCDCCC;">(</span>A, B, C, D<span style="color: #DCDCCC;">)</span>;
sys.StateName = StateName;
sys.StateUnit = StateUnit;

sys.InputName = InputName;
sys.InputUnit = InputUnit;

sys.OutputName = OutputName;
sys.OutputUnit = OutputUnit;
</pre>
</div>
</div>
</div>

<div id="outline-container-orgfed5d4b" class="outline-3">
<h3 id="orgfed5d4b"><span class="section-number-3">4.8</span> Bode Plot</h3>
<div class="outline-text-3" id="text-4-8">
<p>
The transfer function from a disturbance force \(f\) to the measured displacement \(d\) is shown figure <a href="#org2a58760">9</a>.
</p>

<div class="org-src-container">
<pre class="src src-matlab">freqs = logspace<span style="color: #DCDCCC;">(</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span>, <span style="color: #BFEBBF;">3</span>, <span style="color: #BFEBBF;">1000</span><span style="color: #DCDCCC;">)</span>;

<span style="color: #7CB8BB;">figure</span>;
plot<span style="color: #DCDCCC;">(</span>freqs, abs<span style="color: #BFEBBF;">(</span>squeeze<span style="color: #D0BF8F;">(</span>freqresp<span style="color: #93E0E3;">(</span>sys<span style="color: #9FC59F;">(</span><span style="color: #CC9393;">'d', 'f'</span><span style="color: #9FC59F;">)</span><span style="color: #CC9393;">, freqs, 'Hz'</span><span style="color: #93E0E3;">)</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; set</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">gca, 'YScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Amplitude </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">m/N</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="org2a58760" class="figure">
<p><img src="figs/spindle_f_to_d.png" alt="spindle_f_to_d.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Bode plot of the transfer function from \(f\) to \(d\)</p>
</div>
</div>
</div>
</div>

<div id="outline-container-org90551c6" class="outline-2">
<h2 id="org90551c6"><span class="section-number-2">5</span> Power Spectral Density</h2>
<div class="outline-text-2" id="text-5">
</div>
<div id="outline-container-org659372f" class="outline-3">
<h3 id="org659372f"><span class="section-number-3">5.1</span> Compute the PSD</h3>
<div class="outline-text-3" id="text-5-1">
<div class="org-src-container">
<pre class="src src-matlab">n_av = <span style="color: #BFEBBF;">4</span>; <span style="color: #7F9F7F;">% Number of average</span>

<span style="color: #DCDCCC;">[</span>pxx_1rpm, f_1rpm<span style="color: #DCDCCC;">]</span> = pwelch<span style="color: #DCDCCC;">(</span>spindle.rpm1.xasync, hanning<span style="color: #BFEBBF;">(</span>ceil<span style="color: #D0BF8F;">(</span>length<span style="color: #93E0E3;">(</span>spindle.rpm1.xasync<span style="color: #93E0E3;">)</span><span style="color: #7CB8BB;">/</span>n_av<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">[]</span>, <span style="color: #BFEBBF;">[]</span>, spindle.rpm1.Fs<span style="color: #DCDCCC;">)</span>;
<span style="color: #DCDCCC;">[</span>pyy_1rpm, <span style="color: #7CB8BB;">~</span><span style="color: #DCDCCC;">]</span>      = pwelch<span style="color: #DCDCCC;">(</span>spindle.rpm1.yasync, hanning<span style="color: #BFEBBF;">(</span>ceil<span style="color: #D0BF8F;">(</span>length<span style="color: #93E0E3;">(</span>spindle.rpm1.yasync<span style="color: #93E0E3;">)</span><span style="color: #7CB8BB;">/</span>n_av<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">[]</span>, <span style="color: #BFEBBF;">[]</span>, spindle.rpm1.Fs<span style="color: #DCDCCC;">)</span>;
<span style="color: #DCDCCC;">[</span>pzz_1rpm, <span style="color: #7CB8BB;">~</span><span style="color: #DCDCCC;">]</span>      = pwelch<span style="color: #DCDCCC;">(</span>spindle.rpm1.zasync, hanning<span style="color: #BFEBBF;">(</span>ceil<span style="color: #D0BF8F;">(</span>length<span style="color: #93E0E3;">(</span>spindle.rpm1.zasync<span style="color: #93E0E3;">)</span><span style="color: #7CB8BB;">/</span>n_av<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">[]</span>, <span style="color: #BFEBBF;">[]</span>, spindle.rpm1.Fs<span style="color: #DCDCCC;">)</span>;

<span style="color: #DCDCCC;">[</span>pxx_60rpm, f_60rpm<span style="color: #DCDCCC;">]</span> = pwelch<span style="color: #DCDCCC;">(</span>spindle.rpm60.xasync, hanning<span style="color: #BFEBBF;">(</span>ceil<span style="color: #D0BF8F;">(</span>length<span style="color: #93E0E3;">(</span>spindle.rpm60.xasync<span style="color: #93E0E3;">)</span><span style="color: #7CB8BB;">/</span>n_av<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">[]</span>, <span style="color: #BFEBBF;">[]</span>, spindle.rpm60.Fs<span style="color: #DCDCCC;">)</span>;
<span style="color: #DCDCCC;">[</span>pyy_60rpm, <span style="color: #7CB8BB;">~</span><span style="color: #DCDCCC;">]</span>       = pwelch<span style="color: #DCDCCC;">(</span>spindle.rpm60.yasync, hanning<span style="color: #BFEBBF;">(</span>ceil<span style="color: #D0BF8F;">(</span>length<span style="color: #93E0E3;">(</span>spindle.rpm60.yasync<span style="color: #93E0E3;">)</span><span style="color: #7CB8BB;">/</span>n_av<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">[]</span>, <span style="color: #BFEBBF;">[]</span>, spindle.rpm60.Fs<span style="color: #DCDCCC;">)</span>;
<span style="color: #DCDCCC;">[</span>pzz_60rpm, <span style="color: #7CB8BB;">~</span><span style="color: #DCDCCC;">]</span>       = pwelch<span style="color: #DCDCCC;">(</span>spindle.rpm60.zasync, hanning<span style="color: #BFEBBF;">(</span>ceil<span style="color: #D0BF8F;">(</span>length<span style="color: #93E0E3;">(</span>spindle.rpm60.zasync<span style="color: #93E0E3;">)</span><span style="color: #7CB8BB;">/</span>n_av<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span>, <span style="color: #BFEBBF;">[]</span>, <span style="color: #BFEBBF;">[]</span>, spindle.rpm60.Fs<span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-org3690c18" class="outline-3">
<h3 id="org3690c18"><span class="section-number-3">5.2</span> Plot the computed PSD</h3>
<div class="outline-text-3" id="text-5-2">
<p>
The Amplitude Spectral Densities of the displacement of the spindle for the \(x\), \(y\) and \(z\) directions are shown figure <a href="#org94523dd">11</a>. They correspond to the Asynchronous part shown figure <a href="#orgdc342a6">5</a>.
</p>

<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>f_1rpm, <span style="color: #BFEBBF;">(</span>pxx_1rpm<span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, 'DisplayName', '$P_<span style="color: #BFEBBF;">{</span>xx<span style="color: #BFEBBF;">}</span>$ <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span>'<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_1rpm, <span style="color: #BFEBBF;">(</span>pyy_1rpm<span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, 'DisplayName', '$P_<span style="color: #BFEBBF;">{</span>yy<span style="color: #BFEBBF;">}</span>$ <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span>'<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_1rpm, <span style="color: #BFEBBF;">(</span>pzz_1rpm<span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, 'DisplayName', '$P_<span style="color: #BFEBBF;">{</span>zz<span style="color: #BFEBBF;">}</span>$ <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span>'<span style="color: #DCDCCC;">)</span>;
% plot(f_1rpm, spindle.rpm1.adcn<span style="color: #7CB8BB;">*</span>ones(size(f_1rpm)), '<span style="color: #7CB8BB;">--</span>k', 'DisplayName', 'ADC <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">1rpm</span>');
hold off;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; set</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">gca, 'YScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'</span>ASD <span style="color: #BFEBBF;">[</span>$m<span style="color: #7CB8BB;">/\</span>sqrt<span style="color: #D0BF8F;">{</span>Hz<span style="color: #D0BF8F;">}</span>$<span style="color: #BFEBBF;">]</span>'<span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Location', 'northeast'</span><span style="color: #DCDCCC;">)</span>;
xlim<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>f_1rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span>, f_1rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>

<div id="orgd766415" class="figure">
<p><img src="figs/spindle_psd_xyz_1rpm.png" alt="spindle_psd_xyz_1rpm.png" />
</p>
<p><span class="figure-number">Figure 10: </span>Power spectral density of the Asynchronous displacement - 1rpm</p>
</div>

<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, <span style="color: #BFEBBF;">(</span>pxx_60rpm<span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, 'DisplayName', '$P_<span style="color: #BFEBBF;">{</span>xx<span style="color: #BFEBBF;">}</span>$ <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span>'<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, <span style="color: #BFEBBF;">(</span>pyy_60rpm<span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, 'DisplayName', '$P_<span style="color: #BFEBBF;">{</span>yy<span style="color: #BFEBBF;">}</span>$ <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span>'<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, <span style="color: #BFEBBF;">(</span>pzz_60rpm<span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, 'DisplayName', '$P_<span style="color: #BFEBBF;">{</span>zz<span style="color: #BFEBBF;">}</span>$ <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span>'<span style="color: #DCDCCC;">)</span>;
% plot(f_60rpm, spindle.rpm60.adcn<span style="color: #7CB8BB;">*</span>ones(size(f_60rpm)), '<span style="color: #7CB8BB;">--</span>k', 'DisplayName', 'ADC <span style="color: #7CB8BB;">-</span> <span style="color: #BFEBBF;">60rpm</span>');
hold off;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; set</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">gca, 'YScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'</span>ASD <span style="color: #BFEBBF;">[</span>$m<span style="color: #7CB8BB;">/\</span>sqrt<span style="color: #D0BF8F;">{</span>Hz<span style="color: #D0BF8F;">}</span>$<span style="color: #BFEBBF;">]</span>'<span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Location', 'northeast'</span><span style="color: #DCDCCC;">)</span>;
xlim<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>f_60rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span>, f_60rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>

<div id="org94523dd" class="figure">
<p><img src="figs/spindle_psd_xyz_60rpm.png" alt="spindle_psd_xyz_60rpm.png" />
</p>
<p><span class="figure-number">Figure 11: </span>Power spectral density of the Asynchronous displacement - 60rpm</p>
</div>
</div>
</div>

<div id="outline-container-org0a6959c" class="outline-3">
<h3 id="org0a6959c"><span class="section-number-3">5.3</span> Load the model of the spindle</h3>
<div class="outline-text-3" id="text-5-3">
<div class="org-src-container">
<pre class="src src-matlab">load<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'./mat/spindle_model.mat', 'sys'</span><span style="color: #DCDCCC;">)</span>;
Tfd = abs<span style="color: #DCDCCC;">(</span>squeeze<span style="color: #BFEBBF;">(</span>freqresp<span style="color: #D0BF8F;">(</span>sys<span style="color: #93E0E3;">(</span><span style="color: #CC9393;">'d', 'f'</span><span style="color: #93E0E3;">)</span><span style="color: #CC9393;">, f_60rpm, 'Hz'</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-orgb977795" class="outline-3">
<h3 id="orgb977795"><span class="section-number-3">5.4</span> Plot the PSD of the Force using the model</h3>
<div class="outline-text-3" id="text-5-4">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, <span style="color: #BFEBBF;">(</span>pxx_60rpm<span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">./</span>Tfd, <span style="color: #CC9393;">'DisplayName', '$P_</span><span style="color: #BFEBBF;">{</span><span style="color: #CC9393;">xx</span><span style="color: #BFEBBF;">}</span><span style="color: #CC9393;">$'</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; set</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">gca, 'YScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'</span>ASD <span style="color: #BFEBBF;">[</span>$N<span style="color: #7CB8BB;">/\</span>sqrt<span style="color: #D0BF8F;">{</span>Hz<span style="color: #D0BF8F;">}</span>$<span style="color: #BFEBBF;">]</span>'<span style="color: #DCDCCC;">)</span>;
xlim<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>f_60rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span>, f_60rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>

<div id="orgfe4f821" class="figure">
<p><img src="figs/spindle_psd_f_60rpm.png" alt="spindle_psd_f_60rpm.png" />
</p>
<p><span class="figure-number">Figure 12: </span>Power spectral density of the force - 60rpm</p>
</div>
</div>
</div>

<div id="outline-container-orgbd81578" class="outline-3">
<h3 id="orgbd81578"><span class="section-number-3">5.5</span> Estimated Shape of the PSD of the force</h3>
<div class="outline-text-3" id="text-5-5">
<div class="org-src-container">
<pre class="src src-matlab">s = tf<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'s'</span><span style="color: #DCDCCC;">)</span>;

Wd_simple = <span style="color: #BFEBBF;">1e</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">8</span><span style="color: #7CB8BB;">/</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">+</span>s<span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">+</span>s<span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">pi</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">100</span><span style="color: #DCDCCC;">)</span>;
Wf_simple = Wd_simple<span style="color: #7CB8BB;">/</span>tf<span style="color: #DCDCCC;">(</span>sys<span style="color: #BFEBBF;">(</span><span style="color: #CC9393;">'d', 'f'</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
TWf_simple = abs<span style="color: #DCDCCC;">(</span>squeeze<span style="color: #BFEBBF;">(</span>freqresp<span style="color: #D0BF8F;">(</span>Wf_simple, f_60rpm, <span style="color: #CC9393;">'Hz'</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;

% Wf = <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">48902</span><span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">+</span><span style="color: #BFEBBF;">327</span>.<span style="color: #BFEBBF;">9</span>)<span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">109</span>.<span style="color: #BFEBBF;">6</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">1</span>.<span style="color: #BFEBBF;">687e04</span>)<span style="color: #7CB8BB;">/</span>((s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">30</span>.<span style="color: #BFEBBF;">59</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">8541</span>)<span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">29</span>.<span style="color: #BFEBBF;">11</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">3</span>.<span style="color: #BFEBBF;">268e04</span>));
% Wf = <span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">15788</span><span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">+</span><span style="color: #BFEBBF;">418</span>.<span style="color: #BFEBBF;">6</span>)<span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">+</span><span style="color: #BFEBBF;">1697</span>)<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">124</span>.<span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">2</span>.<span style="color: #BFEBBF;">529e04</span>)<span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">681</span>.<span style="color: #BFEBBF;">3</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">9</span>.<span style="color: #BFEBBF;">018e05</span>)<span style="color: #7CB8BB;">/</span>((s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">23</span>.<span style="color: #BFEBBF;">03</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">8916</span>)<span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">33</span>.<span style="color: #BFEBBF;">85</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">6</span>.<span style="color: #BFEBBF;">559e04</span>)<span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">71</span>.<span style="color: #BFEBBF;">43</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">4</span>.<span style="color: #BFEBBF;">283e05</span>)<span style="color: #7CB8BB;">*</span>(s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">40</span>.<span style="color: #BFEBBF;">64</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">1</span>.<span style="color: #BFEBBF;">789e06</span>));

Wf = <span style="color: #DCDCCC;">(</span>s<span style="color: #7CB8BB;">+</span><span style="color: #BFEBBF;">1697</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">*</span><span style="color: #DCDCCC;">(</span>s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">114</span>.<span style="color: #BFEBBF;">5</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">2</span>.<span style="color: #BFEBBF;">278e04</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">*</span><span style="color: #DCDCCC;">(</span>s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">205</span>.<span style="color: #BFEBBF;">1</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">1</span>.<span style="color: #BFEBBF;">627e05</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">*</span><span style="color: #DCDCCC;">(</span>s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">285</span>.<span style="color: #BFEBBF;">8</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">8</span>.<span style="color: #BFEBBF;">624e05</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">*</span><span style="color: #DCDCCC;">(</span>s<span style="color: #7CB8BB;">+</span><span style="color: #BFEBBF;">100</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">(</span>s<span style="color: #7CB8BB;">+</span><span style="color: #BFEBBF;">0</span>.<span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">3012</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">(</span>s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">23</span>.<span style="color: #BFEBBF;">03</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">8916</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">(</span>s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">17</span>.<span style="color: #BFEBBF;">07</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">4</span>.<span style="color: #BFEBBF;">798e04</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">(</span>s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">41</span>.<span style="color: #BFEBBF;">17</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">4</span>.<span style="color: #BFEBBF;">347e05</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">(</span>s<span style="color: #7CB8BB;">^</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">78</span>.<span style="color: #BFEBBF;">99</span><span style="color: #7CB8BB;">*</span>s <span style="color: #7CB8BB;">+</span> <span style="color: #BFEBBF;">1</span>.<span style="color: #BFEBBF;">789e06</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;

TWf = abs<span style="color: #DCDCCC;">(</span>squeeze<span style="color: #BFEBBF;">(</span>freqresp<span style="color: #D0BF8F;">(</span>Wf, f_60rpm, <span style="color: #CC9393;">'Hz'</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>
</div>
</div>

<div id="outline-container-orgebea7be" class="outline-3">
<h3 id="orgebea7be"><span class="section-number-3">5.6</span> PSD in [N]</h3>
<div class="outline-text-3" id="text-5-6">
<p>
Above \(200Hz\), the Amplitude Spectral Density seems dominated by noise coming from the electronics (charge amplifier, ADC, &#x2026;). So we don't know what is the frequency content of the force above that frequency. However, we assume that \(P_{xx}\) is decreasing with \(1/f\) as it seems so be the case below \(100Hz\) (figure <a href="#org94523dd">11</a>).
</p>

<p>
We then fit the PSD of the displacement with a transfer function (figure <a href="#org54db7f7">14</a>).
</p>

<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, <span style="color: #BFEBBF;">(</span>pxx_60rpm<span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">./</span>Tfd, <span style="color: #CC9393;">'DisplayName', '</span>$<span style="color: #7CB8BB;">\</span>sqrt<span style="color: #BFEBBF;">{</span>P_<span style="color: #D0BF8F;">{</span>xx<span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">}</span><span style="color: #7CB8BB;">/|</span>T_<span style="color: #BFEBBF;">{</span>d<span style="color: #7CB8BB;">/</span>f<span style="color: #BFEBBF;">}</span><span style="color: #7CB8BB;">|</span>$'<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, TWf, <span style="color: #CC9393;">'DisplayName', 'Wf'</span><span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, TWf_simple, <span style="color: #CC9393;">'-k', 'DisplayName', 'Wfs'</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; set</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">gca, 'YScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'</span>ASD <span style="color: #BFEBBF;">[</span>$N<span style="color: #7CB8BB;">/\</span>sqrt<span style="color: #D0BF8F;">{</span>Hz<span style="color: #D0BF8F;">}</span>$<span style="color: #BFEBBF;">]</span>'<span style="color: #DCDCCC;">)</span>;
xlim<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>f_60rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span>, f_60rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Location', 'northeast'</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>

<div id="org6eac4af" class="figure">
<p><img src="figs/spindle_psd_f_comp_60rpm.png" alt="spindle_psd_f_comp_60rpm.png" />
</p>
<p><span class="figure-number">Figure 13: </span>Power spectral density of the force - 60rpm</p>
</div>
</div>
</div>

<div id="outline-container-org4818470" class="outline-3">
<h3 id="org4818470"><span class="section-number-3">5.7</span> PSD in [m]</h3>
<div class="outline-text-3" id="text-5-7">
<p>
To obtain the PSD of the force \(f\) that induce such displacement, we use the following formula:
\[ \sqrt{PSD(d)} = |T_{d/f}| \sqrt{PSD(f)} \]
</p>

<p>
And so we have:
\[ \sqrt{PSD(f)} = |T_{d/f}|^{-1} \sqrt{PSD(d)} \]
</p>

<p>
The obtain Power Spectral Density of the force is displayed figure <a href="#org6eac4af">13</a>.
</p>

<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, pxx_60rpm<span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, <span style="color: #CC9393;">'DisplayName', '</span>$<span style="color: #7CB8BB;">\</span>sqrt<span style="color: #BFEBBF;">{</span>P_<span style="color: #D0BF8F;">{</span>xx<span style="color: #D0BF8F;">}</span><span style="color: #BFEBBF;">}</span>$'<span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, TWf<span style="color: #7CB8BB;">.*</span>Tfd, <span style="color: #CC9393;">'DisplayName', '$|W_f|*|T_</span><span style="color: #BFEBBF;">{</span><span style="color: #CC9393;">d/f</span><span style="color: #BFEBBF;">}</span><span style="color: #CC9393;">|$'</span><span style="color: #DCDCCC;">)</span>;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; set</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">gca, 'YScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'</span>ASD <span style="color: #BFEBBF;">[</span>$m<span style="color: #7CB8BB;">/\</span>sqrt<span style="color: #D0BF8F;">{</span>Hz<span style="color: #D0BF8F;">}</span>$<span style="color: #BFEBBF;">]</span>'<span style="color: #DCDCCC;">)</span>;
xlim<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>f_60rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span>, f_60rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Location', 'northeast'</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="org54db7f7" class="figure">
<p><img src="figs/spindle_psd_d_comp_60rpm.png" alt="spindle_psd_d_comp_60rpm.png" />
</p>
<p><span class="figure-number">Figure 14: </span>Comparison of the power spectral density of the measured displacement and of the model</p>
</div>
</div>
</div>

<div id="outline-container-org408aad1" class="outline-3">
<h3 id="org408aad1"><span class="section-number-3">5.8</span> Compute the resulting RMS value [m]</h3>
<div class="outline-text-3" id="text-5-8">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, <span style="color: #BFEBBF;">1e9</span><span style="color: #7CB8BB;">*</span>cumtrapz<span style="color: #BFEBBF;">(</span>f_60rpm, <span style="color: #D0BF8F;">(</span>pxx_60rpm<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, <span style="color: #CC9393;">'--', 'DisplayName', 'Exp. Data'</span><span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_60rpm, <span style="color: #BFEBBF;">1e9</span><span style="color: #7CB8BB;">*</span>cumtrapz<span style="color: #BFEBBF;">(</span>f_60rpm, <span style="color: #D0BF8F;">(</span><span style="color: #93E0E3;">(</span>TWf<span style="color: #7CB8BB;">.*</span>Tfd<span style="color: #93E0E3;">)</span><span style="color: #7CB8BB;">.^</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">.^</span>.<span style="color: #BFEBBF;">5</span>, <span style="color: #CC9393;">'--', 'DisplayName', 'Estimated'</span><span style="color: #DCDCCC;">)</span>;
hold off;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'CPS </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">$nm$ rms</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
xlim<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>f_60rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span>, f_60rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Location', 'southeast'</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="orgf1eaaa3" class="figure">
<p><img src="figs/spindle_cps_d_comp_60rpm.png" alt="spindle_cps_d_comp_60rpm.png" />
</p>
<p><span class="figure-number">Figure 15: </span>Cumulative Power Spectrum - 60rpm</p>
</div>
</div>
</div>

<div id="outline-container-org97cda8b" class="outline-3">
<h3 id="org97cda8b"><span class="section-number-3">5.9</span> Compute the resulting RMS value [m]</h3>
<div class="outline-text-3" id="text-5-9">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #7CB8BB;">figure</span>;
hold on;
plot<span style="color: #DCDCCC;">(</span>f_1rpm, <span style="color: #BFEBBF;">1e9</span><span style="color: #7CB8BB;">*</span>cumtrapz<span style="color: #BFEBBF;">(</span>f_1rpm, <span style="color: #D0BF8F;">(</span>pxx_1rpm<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span>, <span style="color: #CC9393;">'--', 'DisplayName', 'Exp. Data'</span><span style="color: #DCDCCC;">)</span>;
plot<span style="color: #DCDCCC;">(</span>f_1rpm, <span style="color: #BFEBBF;">1e9</span><span style="color: #7CB8BB;">*</span><span style="color: #BFEBBF;">(</span>f_1rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #7CB8BB;">-</span>f_1rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">(</span>length<span style="color: #D0BF8F;">(</span>f_1rpm<span style="color: #D0BF8F;">)</span><span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">*</span>cumsum<span style="color: #BFEBBF;">(</span>pxx_1rpm<span style="color: #BFEBBF;">)</span>, <span style="color: #CC9393;">'--', 'DisplayName', 'Exp. Data'</span><span style="color: #DCDCCC;">)</span>;
hold off;
<span style="color: #7CB8BB;">set</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">gca</span>, <span style="color: #CC9393;">'XScale', 'log'</span><span style="color: #DCDCCC;">)</span>;
xlabel<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Frequency </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">Hz</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span><span style="color: #CC9393;">; ylabel</span><span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'CPS </span><span style="color: #BFEBBF;">[</span><span style="color: #CC9393;">$nm$ rms</span><span style="color: #BFEBBF;">]</span><span style="color: #CC9393;">'</span><span style="color: #DCDCCC;">)</span>;
xlim<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">[</span>f_1rpm<span style="color: #D0BF8F;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #D0BF8F;">)</span>, f_1rpm<span style="color: #D0BF8F;">(</span>end<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">]</span><span style="color: #DCDCCC;">)</span>;
legend<span style="color: #DCDCCC;">(</span><span style="color: #CC9393;">'Location', 'southeast'</span><span style="color: #DCDCCC;">)</span>;
</pre>
</div>


<div id="org4fdbcb3" class="figure">
<p><img src="figs/spindle_cps_d_comp_1rpm.png" alt="spindle_cps_d_comp_1rpm.png" />
</p>
<p><span class="figure-number">Figure 16: </span>Cumulative Power Spectrum - 1rpm</p>
</div>
</div>
</div>
</div>

<div id="outline-container-orgb0ca16b" class="outline-2">
<h2 id="orgb0ca16b"><span class="section-number-2">6</span> Functions</h2>
<div class="outline-text-2" id="text-6">
</div>
<div id="outline-container-org14006e0" class="outline-3">
<h3 id="org14006e0"><span class="section-number-3">6.1</span> getAsynchronousError</h3>
<div class="outline-text-3" id="text-6-1">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DCDCCC;">[</span><span style="color: #DFAF8F;">Wxdec</span><span style="color: #DCDCCC;">]</span> = <span style="color: #93E0E3;">getAsynchronousError</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">data</span>, <span style="color: #DFAF8F;">NbTurn</span><span style="color: #DCDCCC;">)</span>
<span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%%</span>
    L = length<span style="color: #DCDCCC;">(</span>data<span style="color: #DCDCCC;">)</span>;
    res_per_rev = L<span style="color: #7CB8BB;">/</span>NbTurn;

    P = <span style="color: #BFEBBF;">0</span><span style="color: #7CB8BB;">:</span><span style="color: #DCDCCC;">(</span>res_per_rev<span style="color: #7CB8BB;">*</span>NbTurn<span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>;
    Pos = P' <span style="color: #7CB8BB;">*</span> <span style="color: #BFEBBF;">360</span><span style="color: #7CB8BB;">/</span>res_per_rev;

    <span style="color: #7F9F7F;">% Temperature correction</span>
    x1 = myfit2<span style="color: #DCDCCC;">(</span>Pos, data<span style="color: #DCDCCC;">)</span>;

    <span style="color: #7F9F7F;">% Convert data to frequency domain and scale accordingly</span>
    X2 = <span style="color: #BFEBBF;">2</span><span style="color: #7CB8BB;">/</span><span style="color: #DCDCCC;">(</span>res_per_rev<span style="color: #7CB8BB;">*</span>NbTurn<span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">*</span>fft<span style="color: #DCDCCC;">(</span>x1<span style="color: #DCDCCC;">)</span>;
    f2 = <span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">0</span><span style="color: #7CB8BB;">:</span>L<span style="color: #7CB8BB;">-</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span><span style="color: #7CB8BB;">./</span>NbTurn; <span style="color: #7F9F7F;">%upr -&gt; once per revolution</span>

    <span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%%</span>
    X2dec = zeros<span style="color: #DCDCCC;">(</span>size<span style="color: #BFEBBF;">(</span>X2<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;
    <span style="color: #7F9F7F;">% Get only the non integer data</span>
    X2dec<span style="color: #DCDCCC;">(</span>mod<span style="color: #BFEBBF;">(</span>f2<span style="color: #D0BF8F;">(</span><span style="color: #7CB8BB;">:</span><span style="color: #D0BF8F;">)</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span> <span style="color: #7CB8BB;">~=</span> <span style="color: #BFEBBF;">0</span><span style="color: #DCDCCC;">)</span> = X2<span style="color: #DCDCCC;">(</span>mod<span style="color: #BFEBBF;">(</span>f2<span style="color: #D0BF8F;">(</span><span style="color: #7CB8BB;">:</span><span style="color: #D0BF8F;">)</span>, <span style="color: #BFEBBF;">1</span><span style="color: #BFEBBF;">)</span> <span style="color: #7CB8BB;">~=</span> <span style="color: #BFEBBF;">0</span><span style="color: #DCDCCC;">)</span>;

    Wxdec = real<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">(</span>res_per_rev<span style="color: #7CB8BB;">*</span>NbTurn<span style="color: #BFEBBF;">)</span><span style="color: #7CB8BB;">/</span><span style="color: #BFEBBF;">2</span> <span style="color: #7CB8BB;">*</span> ifft<span style="color: #BFEBBF;">(</span>X2dec<span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">)</span>;

    <span style="color: #7F9F7F; font-weight: bold; text-decoration: overline;">%%</span>
    <span style="color: #F0DFAF; font-weight: bold;">function</span> <span style="color: #DFAF8F;">Y</span> =  <span style="color: #93E0E3;">myfit2</span><span style="color: #DCDCCC;">(</span><span style="color: #DFAF8F;">x</span>,<span style="color: #DFAF8F;">y</span><span style="color: #DCDCCC;">)</span>
        A = <span style="color: #DCDCCC;">[</span>x ones<span style="color: #BFEBBF;">(</span>size<span style="color: #D0BF8F;">(</span>x<span style="color: #D0BF8F;">)</span><span style="color: #BFEBBF;">)</span><span style="color: #DCDCCC;">]</span><span style="color: #7CB8BB;">\</span>y;
        a = A<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">1</span><span style="color: #DCDCCC;">)</span>; b = A<span style="color: #DCDCCC;">(</span><span style="color: #BFEBBF;">2</span><span style="color: #DCDCCC;">)</span>;
        Y = y <span style="color: #7CB8BB;">-</span> <span style="color: #DCDCCC;">(</span>a<span style="color: #7CB8BB;">*</span>x <span style="color: #7CB8BB;">+</span> b<span style="color: #DCDCCC;">)</span>;
    <span style="color: #F0DFAF; font-weight: bold;">end</span>
<span style="color: #F0DFAF; font-weight: bold;">end</span>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Thomas Dehaeze</p>
<p class="date">Created: 2019-03-20 mer. 15:17</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>