nass-micro-station-measurem.../Spindle/index.html

1077 lines
98 KiB
HTML
Raw Normal View History

2019-03-14 16:40:28 +01:00
<?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-14 jeu. 16:05 -->
<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="#org582a7f8">1. Data Processing</a>
<ul>
<li><a href="#org92c7e68">1.1. Load Measurement Data</a></li>
<li><a href="#org4bf8c0b">1.2. Convert Signals from [deg] to [sec]</a></li>
<li><a href="#orge118404">1.3. Convert Signals</a></li>
<li><a href="#org51f241b">1.4. Ts and Fs for both measurements</a></li>
<li><a href="#org47c6430">1.5. Find Noise of the ADC [m/sqrt(Hz)]</a></li>
<li><a href="#orgf78e2bb">1.6. Save all the data under spindle struct</a></li>
<li><a href="#org4cde466">1.7. Compute Asynchronous data</a></li>
</ul>
</li>
<li><a href="#orgf52f4e3">2. Time Domain Data</a>
<ul>
<li><a href="#org666b40d">2.1. Plot X-Y-Z position with respect to Time - 1rpm</a></li>
<li><a href="#orgc57c284">2.2. Plot X-Y-Z position with respect to Time - 60rpm</a></li>
<li><a href="#org226f4c7">2.3. Plot Synchronous and Asynchronous - 1rpm</a></li>
<li><a href="#orga9b4bfe">2.4. Plot Synchronous and Asynchronous - 60rpm</a></li>
<li><a href="#orge8a59a9">2.5. Plot X against Y</a></li>
<li><a href="#org13ecbf5">2.6. Plot X against Y - Asynchronous</a></li>
</ul>
</li>
<li><a href="#orga1e3a52">3. Model of the spindle</a>
<ul>
<li><a href="#orgb3c4a8b">3.1. Parameters</a></li>
<li><a href="#org5b0ed07">3.2. Compute Mass and Stiffness Matrices</a></li>
<li><a href="#orge0e6714">3.3. Compute resonance frequencies</a></li>
<li><a href="#org8aceb5c">3.4. From model<sub>damping</sub> compute the Damping Matrix</a></li>
<li><a href="#org33a0406">3.5. Define inputs, outputs and state names</a></li>
<li><a href="#org411dc2e">3.6. Define A, B and C matrices</a></li>
<li><a href="#org0405c88">3.7. Generate the State Space Model</a></li>
<li><a href="#org63d9d51">3.8. Bode Plot</a></li>
</ul>
</li>
<li><a href="#org3b1f78c">4. Power Spectral Density</a>
<ul>
<li><a href="#orgc7a8f97">4.1. Compute the PSD</a></li>
<li><a href="#org39be2c0">4.2. Plot the computed PSD</a></li>
<li><a href="#orgdc0b50c">4.3. Load the model of the spindle</a></li>
<li><a href="#orge584c38">4.4. Plot the PSD of the Force using the model</a></li>
<li><a href="#org60ef02c">4.5. Estimated Shape of the PSD of the force</a></li>
<li><a href="#org7fd667e">4.6. PSD in [N]</a></li>
<li><a href="#orgbc2d41a">4.7. PSD in [m]</a></li>
<li><a href="#org288434b">4.8. Compute the resulting RMS value [m]</a></li>
<li><a href="#org3f4174a">4.9. Compute the resulting RMS value [m]</a></li>
</ul>
</li>
<li><a href="#orgd02ff2d">5. Functions</a>
<ul>
<li><a href="#orgaa6ae15">5.1. getAsynchronousError</a></li>
</ul>
</li>
</ul>
</div>
</div>
<div id="outline-container-org582a7f8" class="outline-2">
<h2 id="org582a7f8"><span class="section-number-2">1</span> Data Processing</h2>
<div class="outline-text-2" id="text-1">
</div>
<div id="outline-container-org92c7e68" class="outline-3">
<h3 id="org92c7e68"><span class="section-number-3">1.1</span> Load Measurement Data</h3>
<div class="outline-text-3" id="text-1-1">
<div class="org-src-container">
<pre class="src src-matlab">spindle_1rpm_table = readtable<span style="color: #707183;">(</span>'<span style="color: #6434A3;">./</span>data<span style="color: #6434A3;">/</span><span style="color: #D0372D;">10turns_1rpm_icepap</span>.txt'<span style="color: #707183;">)</span>;
spindle_60rpm_table = readtable<span style="color: #707183;">(</span>'<span style="color: #6434A3;">./</span>data<span style="color: #6434A3;">/</span><span style="color: #D0372D;">10turns_60rpm_IcepapFIR</span>.txt'<span style="color: #707183;">)</span>;
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">spindle_1rpm_table<span style="color: #707183;">(</span><span style="color: #D0372D;">1</span>, <span style="color: #6434A3;">:</span><span style="color: #707183;">)</span>
</pre>
</div>
<div class="org-src-container">
<pre class="src src-matlab">spindle_1rpm = table2array<span style="color: #707183;">(</span>spindle_1rpm_table<span style="color: #707183;">)</span>;
spindle_60rpm = table2array<span style="color: #707183;">(</span>spindle_60rpm_table<span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-org4bf8c0b" class="outline-3">
<h3 id="org4bf8c0b"><span class="section-number-3">1.2</span> Convert Signals from [deg] to [sec]</h3>
<div class="outline-text-3" id="text-1-2">
<div class="org-src-container">
<pre class="src src-matlab">speed_1rpm = <span style="color: #D0372D;">360</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">60</span>; <span style="color: #8D8D84; font-style: italic;">% [deg/sec]</span>
spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">1</span><span style="color: #707183;">)</span> = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">2</span><span style="color: #707183;">)</span><span style="color: #6434A3;">/</span>speed_1rpm; <span style="color: #8D8D84; font-style: italic;">% From position [deg] to time [s]</span>
speed_60rpm = <span style="color: #D0372D;">360</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">1</span>; <span style="color: #8D8D84; font-style: italic;">% [deg/sec]</span>
spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">1</span><span style="color: #707183;">)</span> = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">2</span><span style="color: #707183;">)</span><span style="color: #6434A3;">/</span>speed_60rpm; <span style="color: #8D8D84; font-style: italic;">% From position [deg] to time [s]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-orge118404" class="outline-3">
<h3 id="orge118404"><span class="section-number-3">1.3</span> Convert Signals</h3>
<div class="outline-text-3" id="text-1-3">
<div class="org-src-container">
<pre class="src src-matlab">% scaling = <span style="color: #D0372D;">1</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">80000</span>; % <span style="color: #D0372D;">80</span> mV<span style="color: #6434A3;">/</span>um
scaling = <span style="color: #D0372D;">1e</span><span style="color: #6434A3;">-</span><span style="color: #D0372D;">6</span>; <span style="color: #8D8D84; font-style: italic;">% [um] to [m]</span>
spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span> = scaling<span style="color: #6434A3;">*</span>spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span>; <span style="color: #8D8D84; font-style: italic;">% [V] to [m]</span>
spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span> = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span><span style="color: #6434A3;">-</span>mean<span style="color: #707183;">(</span>spindle_1rpm<span style="color: #7388D6;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>; <span style="color: #8D8D84; font-style: italic;">% Remove mean</span>
spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span> = scaling<span style="color: #6434A3;">*</span>spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span>; <span style="color: #8D8D84; font-style: italic;">% [V] to [m]</span>
spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span> = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #707183;">)</span><span style="color: #6434A3;">-</span>mean<span style="color: #707183;">(</span>spindle_60rpm<span style="color: #7388D6;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #6434A3;">:</span>end<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>; <span style="color: #8D8D84; font-style: italic;">% Remove mean</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org51f241b" class="outline-3">
<h3 id="org51f241b"><span class="section-number-3">1.4</span> Ts and Fs for both measurements</h3>
<div class="outline-text-3" id="text-1-4">
<div class="org-src-container">
<pre class="src src-matlab">Ts_1rpm = spindle_1rpm<span style="color: #707183;">(</span>end, <span style="color: #D0372D;">1</span><span style="color: #707183;">)</span><span style="color: #6434A3;">/</span><span style="color: #707183;">(</span>length<span style="color: #7388D6;">(</span>spindle_1rpm<span style="color: #909183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">1</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span><span style="color: #707183;">)</span>;
Fs_1rpm = <span style="color: #D0372D;">1</span><span style="color: #6434A3;">/</span>Ts_1rpm;
Ts_60rpm = spindle_60rpm<span style="color: #707183;">(</span>end, <span style="color: #D0372D;">1</span><span style="color: #707183;">)</span><span style="color: #6434A3;">/</span><span style="color: #707183;">(</span>length<span style="color: #7388D6;">(</span>spindle_60rpm<span style="color: #909183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">1</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span><span style="color: #707183;">)</span>;
Fs_60rpm = <span style="color: #D0372D;">1</span><span style="color: #6434A3;">/</span>Ts_60rpm;
</pre>
</div>
</div>
</div>
<div id="outline-container-org47c6430" class="outline-3">
<h3 id="org47c6430"><span class="section-number-3">1.5</span> Find Noise of the ADC [m/sqrt(Hz)]</h3>
<div class="outline-text-3" id="text-1-5">
<div class="org-src-container">
<pre class="src src-matlab">data = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">5</span><span style="color: #707183;">)</span>;
dV_1rpm = min<span style="color: #707183;">(</span>abs<span style="color: #7388D6;">(</span>data<span style="color: #909183;">(</span><span style="color: #D0372D;">1</span><span style="color: #909183;">)</span> <span style="color: #6434A3;">-</span> data<span style="color: #909183;">(</span>data <span style="color: #6434A3;">~=</span> data<span style="color: #709870;">(</span><span style="color: #D0372D;">1</span><span style="color: #709870;">)</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
noise_1rpm = dV_1rpm<span style="color: #6434A3;">/</span>sqrt<span style="color: #707183;">(</span><span style="color: #D0372D;">12</span><span style="color: #6434A3;">*</span>Fs_1rpm<span style="color: #6434A3;">/</span><span style="color: #D0372D;">2</span><span style="color: #707183;">)</span>;
data = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">5</span><span style="color: #707183;">)</span>;
dV_60rpm = min<span style="color: #707183;">(</span>abs<span style="color: #7388D6;">(</span>data<span style="color: #909183;">(</span><span style="color: #D0372D;">50</span><span style="color: #909183;">)</span> <span style="color: #6434A3;">-</span> data<span style="color: #909183;">(</span>data <span style="color: #6434A3;">~=</span> data<span style="color: #709870;">(</span><span style="color: #D0372D;">50</span><span style="color: #709870;">)</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
noise_60rpm = dV_60rpm<span style="color: #6434A3;">/</span>sqrt<span style="color: #707183;">(</span><span style="color: #D0372D;">12</span><span style="color: #6434A3;">*</span>Fs_60rpm<span style="color: #6434A3;">/</span><span style="color: #D0372D;">2</span><span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf78e2bb" class="outline-3">
<h3 id="orgf78e2bb"><span class="section-number-3">1.6</span> Save all the data under spindle struct</h3>
<div class="outline-text-3" id="text-1-6">
<div class="org-src-container">
<pre class="src src-matlab">spindle.rpm1.time = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">1</span><span style="color: #707183;">)</span>;
spindle.rpm1.deg = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">2</span><span style="color: #707183;">)</span>;
spindle.rpm1.Ts = Ts_1rpm;
spindle.rpm1.Fs = <span style="color: #D0372D;">1</span><span style="color: #6434A3;">/</span>Ts_1rpm;
spindle.rpm1.x = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #707183;">)</span>;
spindle.rpm1.y = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">4</span><span style="color: #707183;">)</span>;
spindle.rpm1.z = spindle_1rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">5</span><span style="color: #707183;">)</span>;
spindle.rpm1.adcn = noise_1rpm;
spindle.rpm60.time = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">1</span><span style="color: #707183;">)</span>;
spindle.rpm60.deg = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">2</span><span style="color: #707183;">)</span>;
spindle.rpm60.Ts = Ts_60rpm;
spindle.rpm60.Fs = <span style="color: #D0372D;">1</span><span style="color: #6434A3;">/</span>Ts_60rpm;
spindle.rpm60.x = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">3</span><span style="color: #707183;">)</span>;
spindle.rpm60.y = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">4</span><span style="color: #707183;">)</span>;
spindle.rpm60.z = spindle_60rpm<span style="color: #707183;">(</span><span style="color: #6434A3;">:</span>, <span style="color: #D0372D;">5</span><span style="color: #707183;">)</span>;
spindle.rpm60.adcn = noise_60rpm;
</pre>
</div>
</div>
</div>
<div id="outline-container-org4cde466" class="outline-3">
<h3 id="org4cde466"><span class="section-number-3">1.7</span> Compute Asynchronous data</h3>
<div class="outline-text-3" id="text-1-7">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #0000FF;">for</span> <span style="color: #BA36A5;">direction</span> = <span style="color: #707183;">{</span><span style="color: #008000;">'x'</span><span style="color: #008000;">, 'y', 'z'</span><span style="color: #707183;">}</span>
spindle.rpm1.<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>direction<span style="color: #909183;">{</span><span style="color: #D0372D;">1</span><span style="color: #909183;">}</span>, <span style="color: #008000;">'async'</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span> = getAsynchronousError<span style="color: #707183;">(</span>spindle.rpm1.<span style="color: #7388D6;">(</span>direction<span style="color: #909183;">{</span><span style="color: #D0372D;">1</span><span style="color: #909183;">}</span><span style="color: #7388D6;">)</span>, <span style="color: #D0372D;">10</span><span style="color: #707183;">)</span>;
spindle.rpm60.<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>direction<span style="color: #909183;">{</span><span style="color: #D0372D;">1</span><span style="color: #909183;">}</span>, <span style="color: #008000;">'async'</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span> = getAsynchronousError<span style="color: #707183;">(</span>spindle.rpm60.<span style="color: #7388D6;">(</span>direction<span style="color: #909183;">{</span><span style="color: #D0372D;">1</span><span style="color: #909183;">}</span><span style="color: #7388D6;">)</span>, <span style="color: #D0372D;">10</span><span style="color: #707183;">)</span>;
<span style="color: #0000FF;">end</span>
</pre>
</div>
</div>
</div>
</div>
<div id="outline-container-orgf52f4e3" class="outline-2">
<h2 id="orgf52f4e3"><span class="section-number-2">2</span> Time Domain Data</h2>
<div class="outline-text-2" id="text-2">
</div>
<div id="outline-container-org666b40d" class="outline-3">
<h3 id="org666b40d"><span class="section-number-3">2.1</span> Plot X-Y-Z position with respect to Time - 1rpm</h3>
<div class="outline-text-3" id="text-2-1">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>spindle.rpm1.time, spindle.rpm1.x<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm1.time, spindle.rpm1.y<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm1.time, spindle.rpm1.z<span style="color: #707183;">)</span>;
hold off;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Time </span><span style="color: #7388D6;">[</span><span style="color: #008000;">s</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #7388D6;">{</span>'tx <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span>', 'ty <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span>', 'tz <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span>'<span style="color: #7388D6;">}</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="orgce1b7db" class="figure">
<p><img src="figs/spindle_xyz_1rpm.png" alt="spindle_xyz_1rpm.png" />
</p>
<p><span class="figure-number">Figure 1: </span>Raw time domain translation - 1rpm</p>
</div>
</div>
</div>
<div id="outline-container-orgc57c284" class="outline-3">
<h3 id="orgc57c284"><span class="section-number-3">2.2</span> Plot X-Y-Z position with respect to Time - 60rpm</h3>
<div class="outline-text-3" id="text-2-2">
<p>
The measurements for the spindle turning at 60rpm are shown figure <a href="#org4f8d05b">2</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>spindle.rpm60.time, spindle.rpm60.x<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm60.time, spindle.rpm60.y<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm60.time, spindle.rpm60.z<span style="color: #707183;">)</span>;
hold off;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Time </span><span style="color: #7388D6;">[</span><span style="color: #008000;">s</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #7388D6;">{</span>'tx <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span>', 'ty <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span>', 'tz <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span>'<span style="color: #7388D6;">}</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="org4f8d05b" class="figure">
<p><img src="figs/spindle_xyz_60rpm.png" alt="spindle_xyz_60rpm.png" />
</p>
<p><span class="figure-number">Figure 2: </span>Raw time domain translation - 60rpm</p>
</div>
</div>
</div>
<div id="outline-container-org226f4c7" class="outline-3">
<h3 id="org226f4c7"><span class="section-number-3">2.3</span> Plot Synchronous and Asynchronous - 1rpm</h3>
<div class="outline-text-3" id="text-2-3">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>spindle.rpm1.time, spindle.rpm1.x<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm1.time, spindle.rpm1.xasync<span style="color: #707183;">)</span>;
hold off;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Time </span><span style="color: #7388D6;">[</span><span style="color: #008000;">s</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #7388D6;">{</span>'tx <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span> <span style="color: #6434A3;">-</span> Sync', 'tx <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span> <span style="color: #6434A3;">-</span> Async'<span style="color: #7388D6;">}</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="orgfe160bd" class="figure">
<p><img src="figs/spindle_1rpm_sync_async.png" alt="spindle_1rpm_sync_async.png" />
</p>
<p><span class="figure-number">Figure 3: </span>Comparison of the synchronous and asynchronous displacements - 1rpm</p>
</div>
</div>
</div>
<div id="outline-container-orga9b4bfe" class="outline-3">
<h3 id="orga9b4bfe"><span class="section-number-3">2.4</span> Plot Synchronous and Asynchronous - 60rpm</h3>
<div class="outline-text-3" id="text-2-4">
<p>
The data is split into its Synchronous and Asynchronous part (figure <a href="#org0fa3e9f">4</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: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>spindle.rpm60.time, spindle.rpm60.x<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm60.time, spindle.rpm60.xasync<span style="color: #707183;">)</span>;
hold off;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Time </span><span style="color: #7388D6;">[</span><span style="color: #008000;">s</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #7388D6;">{</span>'tx <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span> <span style="color: #6434A3;">-</span> Sync', 'tx <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span> <span style="color: #6434A3;">-</span> Async'<span style="color: #7388D6;">}</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="org0fa3e9f" class="figure">
<p><img src="figs/spindle_60rpm_sync_async.png" alt="spindle_60rpm_sync_async.png" />
</p>
<p><span class="figure-number">Figure 4: </span>Comparison of the synchronous and asynchronous displacements - 60rpm</p>
</div>
</div>
</div>
<div id="outline-container-orge8a59a9" class="outline-3">
<h3 id="orge8a59a9"><span class="section-number-3">2.5</span> Plot X against Y</h3>
<div class="outline-text-3" id="text-2-5">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>spindle.rpm1.x, spindle.rpm1.y<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm60.x, spindle.rpm60.y<span style="color: #707183;">)</span>;
hold off;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'X Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'Y Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #7388D6;">{</span>'<span style="color: #D0372D;">1rpm</span>', '<span style="color: #D0372D;">60rpm</span>'<span style="color: #7388D6;">}</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="org878572b" class="figure">
<p><img src="figs/spindle_xy_1_60rpm.png" alt="spindle_xy_1_60rpm.png" />
</p>
<p><span class="figure-number">Figure 5: </span>Synchronous x-y displacement</p>
</div>
</div>
</div>
<div id="outline-container-org13ecbf5" class="outline-3">
<h3 id="org13ecbf5"><span class="section-number-3">2.6</span> Plot X against Y - Asynchronous</h3>
<div class="outline-text-3" id="text-2-6">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>spindle.rpm1.xasync, spindle.rpm1.yasync<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>spindle.rpm60.xasync, spindle.rpm60.yasync<span style="color: #707183;">)</span>;
hold off;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'X Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'Y Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #7388D6;">{</span>'<span style="color: #D0372D;">1rpm</span>', '<span style="color: #D0372D;">60rpm</span>'<span style="color: #7388D6;">}</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="orgd3a3383" 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 6: </span>Asynchronous x-y displacement</p>
</div>
</div>
</div>
</div>
<div id="outline-container-orga1e3a52" class="outline-2">
<h2 id="orga1e3a52"><span class="section-number-2">3</span> Model of the spindle</h2>
<div class="outline-text-2" id="text-3">
<p>
The model of the spindle used is shown figure <a href="#org9fcf114">7</a>.
</p>
<p>
\(f\) is the perturbation force of the spindle and \(d\) is the measured displacement.
</p>
<div id="org9fcf114" class="figure">
<p><img src="./figs/uniaxial-model-spindle.png" alt="uniaxial-model-spindle.png" />
</p>
<p><span class="figure-number">Figure 7: </span>Model of the Spindle</p>
</div>
</div>
<div id="outline-container-orgb3c4a8b" class="outline-3">
<h3 id="orgb3c4a8b"><span class="section-number-3">3.1</span> Parameters</h3>
<div class="outline-text-3" id="text-3-1">
<div class="org-src-container">
<pre class="src src-matlab">mg = <span style="color: #D0372D;">3000</span>; <span style="color: #8D8D84; font-style: italic;">% Mass of granite [kg]</span>
ms = <span style="color: #D0372D;">50</span>; <span style="color: #8D8D84; font-style: italic;">% Mass of Spindle [kg]</span>
kg = <span style="color: #D0372D;">1e8</span>; <span style="color: #8D8D84; font-style: italic;">% Stiffness of granite [N/m]</span>
ks = <span style="color: #D0372D;">5e7</span>; <span style="color: #8D8D84; font-style: italic;">% Stiffness of spindle [N/m]</span>
</pre>
</div>
</div>
</div>
<div id="outline-container-org5b0ed07" class="outline-3">
<h3 id="org5b0ed07"><span class="section-number-3">3.2</span> Compute Mass and Stiffness Matrices</h3>
<div class="outline-text-3" id="text-3-2">
<div class="org-src-container">
<pre class="src src-matlab">Mm = diag<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>ms, mg<span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
Km = diag<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>ks, ks<span style="color: #6434A3;">+</span>kg<span style="color: #7388D6;">]</span><span style="color: #707183;">)</span> <span style="color: #6434A3;">-</span> diag<span style="color: #707183;">(</span>ks, <span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span><span style="color: #707183;">)</span> <span style="color: #6434A3;">-</span> diag<span style="color: #707183;">(</span>ks, <span style="color: #D0372D;">1</span><span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-orge0e6714" class="outline-3">
<h3 id="orge0e6714"><span class="section-number-3">3.3</span> Compute resonance frequencies</h3>
<div class="outline-text-3" id="text-3-3">
<div class="org-src-container">
<pre class="src src-matlab">A = <span style="color: #707183;">[</span>zeros<span style="color: #7388D6;">(</span>size<span style="color: #909183;">(</span>Mm<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span> eye<span style="color: #7388D6;">(</span>size<span style="color: #909183;">(</span>Mm<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span> ; <span style="color: #6434A3;">-</span>Mm<span style="color: #6434A3;">\</span>Km zeros<span style="color: #7388D6;">(</span>size<span style="color: #909183;">(</span>Mm<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">]</span>;
eigA = imag<span style="color: #707183;">(</span>eigs<span style="color: #7388D6;">(</span>A<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">2</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">pi</span>;
eigA = eigA<span style="color: #707183;">(</span>eigA<span style="color: #6434A3;">&gt;</span><span style="color: #D0372D;">0</span><span style="color: #707183;">)</span>;
eigA = eigA<span style="color: #707183;">(</span><span style="color: #D0372D;">1</span><span style="color: #6434A3;">:</span><span style="color: #D0372D;">2</span><span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-org8aceb5c" class="outline-3">
<h3 id="org8aceb5c"><span class="section-number-3">3.4</span> From model<sub>damping</sub> compute the Damping Matrix</h3>
<div class="outline-text-3" id="text-3-4">
<div class="org-src-container">
<pre class="src src-matlab">modal_damping = <span style="color: #D0372D;">1e</span><span style="color: #6434A3;">-</span><span style="color: #D0372D;">5</span>;
ab = <span style="color: #707183;">[</span><span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">5</span><span style="color: #6434A3;">*</span>eigA<span style="color: #7388D6;">(</span><span style="color: #D0372D;">1</span><span style="color: #7388D6;">)</span> <span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">5</span><span style="color: #6434A3;">/</span>eigA<span style="color: #7388D6;">(</span><span style="color: #D0372D;">1</span><span style="color: #7388D6;">)</span> ; <span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">5</span><span style="color: #6434A3;">*</span>eigA<span style="color: #7388D6;">(</span><span style="color: #D0372D;">2</span><span style="color: #7388D6;">)</span> <span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">5</span><span style="color: #6434A3;">/</span>eigA<span style="color: #7388D6;">(</span><span style="color: #D0372D;">2</span><span style="color: #7388D6;">)</span><span style="color: #707183;">]</span><span style="color: #6434A3;">\</span><span style="color: #707183;">[</span>modal_damping ; modal_damping<span style="color: #707183;">]</span>;
Cm = ab<span style="color: #707183;">(</span><span style="color: #D0372D;">1</span><span style="color: #707183;">)</span><span style="color: #6434A3;">*</span>Mm <span style="color: #6434A3;">+</span>ab<span style="color: #707183;">(</span><span style="color: #D0372D;">2</span><span style="color: #707183;">)</span><span style="color: #6434A3;">*</span>Km;
</pre>
</div>
</div>
</div>
<div id="outline-container-org33a0406" class="outline-3">
<h3 id="org33a0406"><span class="section-number-3">3.5</span> Define inputs, outputs and state names</h3>
<div class="outline-text-3" id="text-3-5">
<div class="org-src-container">
<pre class="src src-matlab">StateName = <span style="color: #707183;">{</span><span style="text-decoration: underline;">...</span>
<span style="color: #008000;">'xs'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #8D8D84; font-style: italic;">% Displacement of Spindle [m]</span>
<span style="color: #008000;">'xg'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #8D8D84; font-style: italic;">% Displacement of Granite [m]</span>
<span style="color: #008000;">'vs'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #8D8D84; font-style: italic;">% Velocity of Spindle [m]</span>
<span style="color: #008000;">'vg'</span>, <span style="text-decoration: underline;">...</span> <span style="color: #8D8D84; font-style: italic;">% Velocity of Granite [m]</span>
<span style="color: #707183;">}</span>;
StateUnit = <span style="color: #707183;">{</span><span style="color: #008000;">'m', 'm', 'm/s', 'm/s'</span><span style="color: #707183;">}</span>;
InputName = <span style="color: #707183;">{</span><span style="text-decoration: underline;">...</span>
<span style="color: #008000;">'f'</span> <span style="text-decoration: underline;">...</span> <span style="color: #8D8D84; font-style: italic;">% Spindle Force [N]</span>
<span style="color: #707183;">}</span>;
InputUnit = <span style="color: #707183;">{</span><span style="color: #008000;">'N'</span><span style="color: #707183;">}</span>;
OutputName = <span style="color: #707183;">{</span><span style="text-decoration: underline;">...</span>
<span style="color: #008000;">'d'</span> <span style="text-decoration: underline;">...</span> <span style="color: #8D8D84; font-style: italic;">% Displacement [m]</span>
<span style="color: #707183;">}</span>;
OutputUnit = <span style="color: #707183;">{</span><span style="color: #008000;">'m'</span><span style="color: #707183;">}</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-org411dc2e" class="outline-3">
<h3 id="org411dc2e"><span class="section-number-3">3.6</span> Define A, B and C matrices</h3>
<div class="outline-text-3" id="text-3-6">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #8D8D84; font-style: italic;">% A Matrix</span>
A = <span style="color: #707183;">[</span>zeros<span style="color: #7388D6;">(</span>size<span style="color: #909183;">(</span>Mm<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span> eye<span style="color: #7388D6;">(</span>size<span style="color: #909183;">(</span>Mm<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span> ; <span style="text-decoration: underline;">...</span>
<span style="color: #6434A3;">-</span>Mm<span style="color: #6434A3;">\</span>Km <span style="color: #6434A3;">-</span>Mm<span style="color: #6434A3;">\</span>Cm<span style="color: #707183;">]</span>;
<span style="color: #8D8D84; font-style: italic;">% B Matrix</span>
B_low = zeros<span style="color: #707183;">(</span>length<span style="color: #7388D6;">(</span>StateName<span style="color: #7388D6;">)</span>, length<span style="color: #7388D6;">(</span>InputName<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
B_low<span style="color: #707183;">(</span>strcmp<span style="color: #7388D6;">(</span>StateName,<span style="color: #008000;">'vs'</span><span style="color: #7388D6;">)</span><span style="color: #008000;">, strcmp</span><span style="color: #7388D6;">(</span><span style="color: #008000;">InputName,'f'</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span> = <span style="color: #D0372D;">1</span>;
B_low<span style="color: #707183;">(</span>strcmp<span style="color: #7388D6;">(</span>StateName,<span style="color: #008000;">'vg'</span><span style="color: #7388D6;">)</span><span style="color: #008000;">, strcmp</span><span style="color: #7388D6;">(</span><span style="color: #008000;">InputName,'f'</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span> = <span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span>;
B = blkdiag<span style="color: #707183;">(</span>zeros<span style="color: #7388D6;">(</span>length<span style="color: #909183;">(</span>StateName<span style="color: #909183;">)</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">2</span><span style="color: #7388D6;">)</span>, pinv<span style="color: #7388D6;">(</span>Mm<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span><span style="color: #6434A3;">*</span>B_low;
<span style="color: #8D8D84; font-style: italic;">% C Matrix</span>
C = zeros<span style="color: #707183;">(</span>length<span style="color: #7388D6;">(</span>OutputName<span style="color: #7388D6;">)</span>, length<span style="color: #7388D6;">(</span>StateName<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
C<span style="color: #707183;">(</span>strcmp<span style="color: #7388D6;">(</span>OutputName,<span style="color: #008000;">'d'</span><span style="color: #7388D6;">)</span><span style="color: #008000;">, strcmp</span><span style="color: #7388D6;">(</span><span style="color: #008000;">StateName,'xs'</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span> = <span style="color: #D0372D;">1</span>;
C<span style="color: #707183;">(</span>strcmp<span style="color: #7388D6;">(</span>OutputName,<span style="color: #008000;">'d'</span><span style="color: #7388D6;">)</span><span style="color: #008000;">, strcmp</span><span style="color: #7388D6;">(</span><span style="color: #008000;">StateName,'xg'</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span> = <span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span>;
<span style="color: #8D8D84; font-style: italic;">% D Matrix</span>
D = zeros<span style="color: #707183;">(</span>length<span style="color: #7388D6;">(</span>OutputName<span style="color: #7388D6;">)</span>, length<span style="color: #7388D6;">(</span>InputName<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-org0405c88" class="outline-3">
<h3 id="org0405c88"><span class="section-number-3">3.7</span> Generate the State Space Model</h3>
<div class="outline-text-3" id="text-3-7">
<div class="org-src-container">
<pre class="src src-matlab">sys = ss<span style="color: #707183;">(</span>A, B, C, D<span style="color: #707183;">)</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-org63d9d51" class="outline-3">
<h3 id="org63d9d51"><span class="section-number-3">3.8</span> Bode Plot</h3>
<div class="outline-text-3" id="text-3-8">
<p>
The transfer function from a disturbance force \(f\) to the measured displacement \(d\) is shown figure <a href="#org5cbe9b7">8</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab">freqs = logspace<span style="color: #707183;">(</span><span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span>, <span style="color: #D0372D;">3</span>, <span style="color: #D0372D;">1000</span><span style="color: #707183;">)</span>;
<span style="color: #6434A3;">figure</span>;
plot<span style="color: #707183;">(</span>freqs, abs<span style="color: #7388D6;">(</span>squeeze<span style="color: #909183;">(</span>freqresp<span style="color: #709870;">(</span>sys<span style="color: #907373;">(</span><span style="color: #008000;">'d', 'f'</span><span style="color: #907373;">)</span><span style="color: #008000;">, freqs, 'Hz'</span><span style="color: #709870;">)</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span><span style="color: #008000;">; set</span><span style="color: #707183;">(</span><span style="color: #008000;">gca, 'YScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'Amplitude </span><span style="color: #7388D6;">[</span><span style="color: #008000;">m/N</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="org5cbe9b7" class="figure">
<p><img src="figs/spindle_f_to_d.png" alt="spindle_f_to_d.png" />
</p>
<p><span class="figure-number">Figure 8: </span>Bode plot of the transfer function from \(f\) to \(d\)</p>
</div>
</div>
</div>
</div>
<div id="outline-container-org3b1f78c" class="outline-2">
<h2 id="org3b1f78c"><span class="section-number-2">4</span> Power Spectral Density</h2>
<div class="outline-text-2" id="text-4">
</div>
<div id="outline-container-orgc7a8f97" class="outline-3">
<h3 id="orgc7a8f97"><span class="section-number-3">4.1</span> Compute the PSD</h3>
<div class="outline-text-3" id="text-4-1">
<div class="org-src-container">
<pre class="src src-matlab">n_av = <span style="color: #D0372D;">4</span>; <span style="color: #8D8D84; font-style: italic;">% Number of average</span>
<span style="color: #707183;">[</span>pxx_1rpm, f_1rpm<span style="color: #707183;">]</span> = pwelch<span style="color: #707183;">(</span>spindle.rpm1.xasync, hanning<span style="color: #7388D6;">(</span>ceil<span style="color: #909183;">(</span>length<span style="color: #709870;">(</span>spindle.rpm1.xasync<span style="color: #709870;">)</span><span style="color: #6434A3;">/</span>n_av<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span>, <span style="color: #7388D6;">[]</span>, <span style="color: #7388D6;">[]</span>, spindle.rpm1.Fs<span style="color: #707183;">)</span>;
<span style="color: #707183;">[</span>pyy_1rpm, <span style="color: #6434A3;">~</span><span style="color: #707183;">]</span> = pwelch<span style="color: #707183;">(</span>spindle.rpm1.yasync, hanning<span style="color: #7388D6;">(</span>ceil<span style="color: #909183;">(</span>length<span style="color: #709870;">(</span>spindle.rpm1.yasync<span style="color: #709870;">)</span><span style="color: #6434A3;">/</span>n_av<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span>, <span style="color: #7388D6;">[]</span>, <span style="color: #7388D6;">[]</span>, spindle.rpm1.Fs<span style="color: #707183;">)</span>;
<span style="color: #707183;">[</span>pzz_1rpm, <span style="color: #6434A3;">~</span><span style="color: #707183;">]</span> = pwelch<span style="color: #707183;">(</span>spindle.rpm1.zasync, hanning<span style="color: #7388D6;">(</span>ceil<span style="color: #909183;">(</span>length<span style="color: #709870;">(</span>spindle.rpm1.zasync<span style="color: #709870;">)</span><span style="color: #6434A3;">/</span>n_av<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span>, <span style="color: #7388D6;">[]</span>, <span style="color: #7388D6;">[]</span>, spindle.rpm1.Fs<span style="color: #707183;">)</span>;
<span style="color: #707183;">[</span>pxx_60rpm, f_60rpm<span style="color: #707183;">]</span> = pwelch<span style="color: #707183;">(</span>spindle.rpm60.xasync, hanning<span style="color: #7388D6;">(</span>ceil<span style="color: #909183;">(</span>length<span style="color: #709870;">(</span>spindle.rpm60.xasync<span style="color: #709870;">)</span><span style="color: #6434A3;">/</span>n_av<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span>, <span style="color: #7388D6;">[]</span>, <span style="color: #7388D6;">[]</span>, spindle.rpm60.Fs<span style="color: #707183;">)</span>;
<span style="color: #707183;">[</span>pyy_60rpm, <span style="color: #6434A3;">~</span><span style="color: #707183;">]</span> = pwelch<span style="color: #707183;">(</span>spindle.rpm60.yasync, hanning<span style="color: #7388D6;">(</span>ceil<span style="color: #909183;">(</span>length<span style="color: #709870;">(</span>spindle.rpm60.yasync<span style="color: #709870;">)</span><span style="color: #6434A3;">/</span>n_av<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span>, <span style="color: #7388D6;">[]</span>, <span style="color: #7388D6;">[]</span>, spindle.rpm60.Fs<span style="color: #707183;">)</span>;
<span style="color: #707183;">[</span>pzz_60rpm, <span style="color: #6434A3;">~</span><span style="color: #707183;">]</span> = pwelch<span style="color: #707183;">(</span>spindle.rpm60.zasync, hanning<span style="color: #7388D6;">(</span>ceil<span style="color: #909183;">(</span>length<span style="color: #709870;">(</span>spindle.rpm60.zasync<span style="color: #709870;">)</span><span style="color: #6434A3;">/</span>n_av<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span>, <span style="color: #7388D6;">[]</span>, <span style="color: #7388D6;">[]</span>, spindle.rpm60.Fs<span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-org39be2c0" class="outline-3">
<h3 id="org39be2c0"><span class="section-number-3">4.2</span> Plot the computed PSD</h3>
<div class="outline-text-3" id="text-4-2">
<p>
The Amplitude Spectral Densities of the displacement of the spindle for the \(x\), \(y\) and \(z\) directions are shown figure <a href="#orgeeea5dc">10</a>. They correspond to the Asynchronous part shown figure <a href="#org0fa3e9f">4</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>f_1rpm, <span style="color: #7388D6;">(</span>pxx_1rpm<span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, 'DisplayName', '$P_<span style="color: #7388D6;">{</span>xx<span style="color: #7388D6;">}</span>$ <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span>'<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_1rpm, <span style="color: #7388D6;">(</span>pyy_1rpm<span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, 'DisplayName', '$P_<span style="color: #7388D6;">{</span>yy<span style="color: #7388D6;">}</span>$ <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span>'<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_1rpm, <span style="color: #7388D6;">(</span>pzz_1rpm<span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, 'DisplayName', '$P_<span style="color: #7388D6;">{</span>zz<span style="color: #7388D6;">}</span>$ <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span>'<span style="color: #707183;">)</span>;
% plot(f_1rpm, spindle.rpm1.adcn<span style="color: #6434A3;">*</span>ones(size(f_1rpm)), '<span style="color: #6434A3;">--</span>k', 'DisplayName', 'ADC <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">1rpm</span>');
hold off;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span><span style="color: #008000;">; set</span><span style="color: #707183;">(</span><span style="color: #008000;">gca, 'YScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'</span>ASD <span style="color: #7388D6;">[</span>$m<span style="color: #6434A3;">/\</span>sqrt<span style="color: #909183;">{</span>Hz<span style="color: #909183;">}</span>$<span style="color: #7388D6;">]</span>'<span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #008000;">'Location', 'northeast'</span><span style="color: #707183;">)</span>;
xlim<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>f_1rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span>, f_1rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="org1d107b9" class="figure">
<p><img src="figs/spindle_psd_xyz_1rpm.png" alt="spindle_psd_xyz_1rpm.png" />
</p>
<p><span class="figure-number">Figure 9: </span>Power spectral density of the Asynchronous displacement - 1rpm</p>
</div>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>f_60rpm, <span style="color: #7388D6;">(</span>pxx_60rpm<span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, 'DisplayName', '$P_<span style="color: #7388D6;">{</span>xx<span style="color: #7388D6;">}</span>$ <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span>'<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_60rpm, <span style="color: #7388D6;">(</span>pyy_60rpm<span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, 'DisplayName', '$P_<span style="color: #7388D6;">{</span>yy<span style="color: #7388D6;">}</span>$ <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span>'<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_60rpm, <span style="color: #7388D6;">(</span>pzz_60rpm<span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, 'DisplayName', '$P_<span style="color: #7388D6;">{</span>zz<span style="color: #7388D6;">}</span>$ <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span>'<span style="color: #707183;">)</span>;
% plot(f_60rpm, spindle.rpm60.adcn<span style="color: #6434A3;">*</span>ones(size(f_60rpm)), '<span style="color: #6434A3;">--</span>k', 'DisplayName', 'ADC <span style="color: #6434A3;">-</span> <span style="color: #D0372D;">60rpm</span>');
hold off;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span><span style="color: #008000;">; set</span><span style="color: #707183;">(</span><span style="color: #008000;">gca, 'YScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'</span>ASD <span style="color: #7388D6;">[</span>$m<span style="color: #6434A3;">/\</span>sqrt<span style="color: #909183;">{</span>Hz<span style="color: #909183;">}</span>$<span style="color: #7388D6;">]</span>'<span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #008000;">'Location', 'northeast'</span><span style="color: #707183;">)</span>;
xlim<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>f_60rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span>, f_60rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="orgeeea5dc" class="figure">
<p><img src="figs/spindle_psd_xyz_60rpm.png" alt="spindle_psd_xyz_60rpm.png" />
</p>
<p><span class="figure-number">Figure 10: </span>Power spectral density of the Asynchronous displacement - 60rpm</p>
</div>
</div>
</div>
<div id="outline-container-orgdc0b50c" class="outline-3">
<h3 id="orgdc0b50c"><span class="section-number-3">4.3</span> Load the model of the spindle</h3>
<div class="outline-text-3" id="text-4-3">
<div class="org-src-container">
<pre class="src src-matlab">load<span style="color: #707183;">(</span><span style="color: #008000;">'./mat/spindle_model.mat', 'sys'</span><span style="color: #707183;">)</span>;
Tfd = abs<span style="color: #707183;">(</span>squeeze<span style="color: #7388D6;">(</span>freqresp<span style="color: #909183;">(</span>sys<span style="color: #709870;">(</span><span style="color: #008000;">'d', 'f'</span><span style="color: #709870;">)</span><span style="color: #008000;">, f_60rpm, 'Hz'</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-orge584c38" class="outline-3">
<h3 id="orge584c38"><span class="section-number-3">4.4</span> Plot the PSD of the Force using the model</h3>
<div class="outline-text-3" id="text-4-4">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
plot<span style="color: #707183;">(</span>f_60rpm, <span style="color: #7388D6;">(</span>pxx_60rpm<span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">./</span>Tfd, <span style="color: #008000;">'DisplayName', '$P_</span><span style="color: #7388D6;">{</span><span style="color: #008000;">xx</span><span style="color: #7388D6;">}</span><span style="color: #008000;">$'</span><span style="color: #707183;">)</span>;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span><span style="color: #008000;">; set</span><span style="color: #707183;">(</span><span style="color: #008000;">gca, 'YScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'</span>ASD <span style="color: #7388D6;">[</span>$N<span style="color: #6434A3;">/\</span>sqrt<span style="color: #909183;">{</span>Hz<span style="color: #909183;">}</span>$<span style="color: #7388D6;">]</span>'<span style="color: #707183;">)</span>;
xlim<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>f_60rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span>, f_60rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="org07646f6" class="figure">
<p><img src="figs/spindle_psd_f_60rpm.png" alt="spindle_psd_f_60rpm.png" />
</p>
<p><span class="figure-number">Figure 11: </span>Power spectral density of the force - 60rpm</p>
</div>
</div>
</div>
<div id="outline-container-org60ef02c" class="outline-3">
<h3 id="org60ef02c"><span class="section-number-3">4.5</span> Estimated Shape of the PSD of the force</h3>
<div class="outline-text-3" id="text-4-5">
<div class="org-src-container">
<pre class="src src-matlab">s = tf<span style="color: #707183;">(</span><span style="color: #008000;">'s'</span><span style="color: #707183;">)</span>;
Wd_simple = <span style="color: #D0372D;">1e</span><span style="color: #6434A3;">-</span><span style="color: #D0372D;">8</span><span style="color: #6434A3;">/</span><span style="color: #707183;">(</span><span style="color: #D0372D;">1</span><span style="color: #6434A3;">+</span>s<span style="color: #6434A3;">/</span><span style="color: #D0372D;">2</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">pi</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">5</span><span style="color: #707183;">)</span><span style="color: #6434A3;">/</span><span style="color: #707183;">(</span><span style="color: #D0372D;">1</span><span style="color: #6434A3;">+</span>s<span style="color: #6434A3;">/</span><span style="color: #D0372D;">2</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">pi</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">100</span><span style="color: #707183;">)</span>;
Wf_simple = Wd_simple<span style="color: #6434A3;">/</span>tf<span style="color: #707183;">(</span>sys<span style="color: #7388D6;">(</span><span style="color: #008000;">'d', 'f'</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
TWf_simple = abs<span style="color: #707183;">(</span>squeeze<span style="color: #7388D6;">(</span>freqresp<span style="color: #909183;">(</span>Wf_simple, f_60rpm, <span style="color: #008000;">'Hz'</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
% Wf = <span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">48902</span><span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">+</span><span style="color: #D0372D;">327</span>.<span style="color: #D0372D;">9</span>)<span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">109</span>.<span style="color: #D0372D;">6</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">1</span>.<span style="color: #D0372D;">687e04</span>)<span style="color: #6434A3;">/</span>((s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">30</span>.<span style="color: #D0372D;">59</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">8541</span>)<span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">29</span>.<span style="color: #D0372D;">11</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">3</span>.<span style="color: #D0372D;">268e04</span>));
% Wf = <span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">15788</span><span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">+</span><span style="color: #D0372D;">418</span>.<span style="color: #D0372D;">6</span>)<span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">+</span><span style="color: #D0372D;">1697</span>)<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span><span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">124</span>.<span style="color: #D0372D;">3</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">2</span>.<span style="color: #D0372D;">529e04</span>)<span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">681</span>.<span style="color: #D0372D;">3</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">9</span>.<span style="color: #D0372D;">018e05</span>)<span style="color: #6434A3;">/</span>((s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">23</span>.<span style="color: #D0372D;">03</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">8916</span>)<span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">33</span>.<span style="color: #D0372D;">85</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">6</span>.<span style="color: #D0372D;">559e04</span>)<span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">71</span>.<span style="color: #D0372D;">43</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">4</span>.<span style="color: #D0372D;">283e05</span>)<span style="color: #6434A3;">*</span>(s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">40</span>.<span style="color: #D0372D;">64</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">1</span>.<span style="color: #D0372D;">789e06</span>));
Wf = <span style="color: #707183;">(</span>s<span style="color: #6434A3;">+</span><span style="color: #D0372D;">1697</span><span style="color: #707183;">)</span><span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span><span style="color: #6434A3;">*</span><span style="color: #707183;">(</span>s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">114</span>.<span style="color: #D0372D;">5</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">2</span>.<span style="color: #D0372D;">278e04</span><span style="color: #707183;">)</span><span style="color: #6434A3;">*</span><span style="color: #707183;">(</span>s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">205</span>.<span style="color: #D0372D;">1</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">1</span>.<span style="color: #D0372D;">627e05</span><span style="color: #707183;">)</span><span style="color: #6434A3;">*</span><span style="color: #707183;">(</span>s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">285</span>.<span style="color: #D0372D;">8</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">8</span>.<span style="color: #D0372D;">624e05</span><span style="color: #707183;">)</span><span style="color: #6434A3;">*</span><span style="color: #707183;">(</span>s<span style="color: #6434A3;">+</span><span style="color: #D0372D;">100</span><span style="color: #707183;">)</span><span style="color: #6434A3;">/</span><span style="color: #707183;">(</span><span style="color: #7388D6;">(</span>s<span style="color: #6434A3;">+</span><span style="color: #D0372D;">0</span>.<span style="color: #D0372D;">5</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">*</span><span style="color: #D0372D;">3012</span><span style="color: #6434A3;">*</span><span style="color: #7388D6;">(</span>s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">23</span>.<span style="color: #D0372D;">03</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">8916</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">*</span><span style="color: #7388D6;">(</span>s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">17</span>.<span style="color: #D0372D;">07</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">4</span>.<span style="color: #D0372D;">798e04</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">*</span><span style="color: #7388D6;">(</span>s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">41</span>.<span style="color: #D0372D;">17</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">4</span>.<span style="color: #D0372D;">347e05</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">*</span><span style="color: #7388D6;">(</span>s<span style="color: #6434A3;">^</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">78</span>.<span style="color: #D0372D;">99</span><span style="color: #6434A3;">*</span>s <span style="color: #6434A3;">+</span> <span style="color: #D0372D;">1</span>.<span style="color: #D0372D;">789e06</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
TWf = abs<span style="color: #707183;">(</span>squeeze<span style="color: #7388D6;">(</span>freqresp<span style="color: #909183;">(</span>Wf, f_60rpm, <span style="color: #008000;">'Hz'</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
</pre>
</div>
</div>
</div>
<div id="outline-container-org7fd667e" class="outline-3">
<h3 id="org7fd667e"><span class="section-number-3">4.6</span> PSD in [N]</h3>
<div class="outline-text-3" id="text-4-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="#orgeeea5dc">10</a>).
</p>
<p>
We then fit the PSD of the displacement with a transfer function (figure <a href="#orgdbfa51e">13</a>).
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>f_60rpm, <span style="color: #7388D6;">(</span>pxx_60rpm<span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">./</span>Tfd, <span style="color: #008000;">'DisplayName', '</span>$<span style="color: #6434A3;">\</span>sqrt<span style="color: #7388D6;">{</span>P_<span style="color: #909183;">{</span>xx<span style="color: #909183;">}</span><span style="color: #7388D6;">}</span><span style="color: #6434A3;">/|</span>T_<span style="color: #7388D6;">{</span>d<span style="color: #6434A3;">/</span>f<span style="color: #7388D6;">}</span><span style="color: #6434A3;">|</span>$'<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_60rpm, TWf, <span style="color: #008000;">'DisplayName', 'Wf'</span><span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_60rpm, TWf_simple, <span style="color: #008000;">'-k', 'DisplayName', 'Wfs'</span><span style="color: #707183;">)</span>;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span><span style="color: #008000;">; set</span><span style="color: #707183;">(</span><span style="color: #008000;">gca, 'YScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'</span>ASD <span style="color: #7388D6;">[</span>$N<span style="color: #6434A3;">/\</span>sqrt<span style="color: #909183;">{</span>Hz<span style="color: #909183;">}</span>$<span style="color: #7388D6;">]</span>'<span style="color: #707183;">)</span>;
xlim<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>f_60rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span>, f_60rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #008000;">'Location', 'northeast'</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="orge4a44bd" 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 12: </span>Power spectral density of the force - 60rpm</p>
</div>
</div>
</div>
<div id="outline-container-orgbc2d41a" class="outline-3">
<h3 id="orgbc2d41a"><span class="section-number-3">4.7</span> PSD in [m]</h3>
<div class="outline-text-3" id="text-4-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="#orge4a44bd">12</a>.
</p>
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>f_60rpm, pxx_60rpm<span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, <span style="color: #008000;">'DisplayName', '</span>$<span style="color: #6434A3;">\</span>sqrt<span style="color: #7388D6;">{</span>P_<span style="color: #909183;">{</span>xx<span style="color: #909183;">}</span><span style="color: #7388D6;">}</span>$'<span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_60rpm, TWf<span style="color: #6434A3;">.*</span>Tfd, <span style="color: #008000;">'DisplayName', '$|W_f|*|T_</span><span style="color: #7388D6;">{</span><span style="color: #008000;">d/f</span><span style="color: #7388D6;">}</span><span style="color: #008000;">|$'</span><span style="color: #707183;">)</span>;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span><span style="color: #008000;">; set</span><span style="color: #707183;">(</span><span style="color: #008000;">gca, 'YScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'</span>ASD <span style="color: #7388D6;">[</span>$m<span style="color: #6434A3;">/\</span>sqrt<span style="color: #909183;">{</span>Hz<span style="color: #909183;">}</span>$<span style="color: #7388D6;">]</span>'<span style="color: #707183;">)</span>;
xlim<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>f_60rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span>, f_60rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #008000;">'Location', 'northeast'</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="orgdbfa51e" 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 13: </span>Comparison of the power spectral density of the measured displacement and of the model</p>
</div>
</div>
</div>
<div id="outline-container-org288434b" class="outline-3">
<h3 id="org288434b"><span class="section-number-3">4.8</span> Compute the resulting RMS value [m]</h3>
<div class="outline-text-3" id="text-4-8">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>f_60rpm, <span style="color: #D0372D;">1e9</span><span style="color: #6434A3;">*</span>cumtrapz<span style="color: #7388D6;">(</span>f_60rpm, <span style="color: #909183;">(</span>pxx_60rpm<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, <span style="color: #008000;">'--', 'DisplayName', 'Exp. Data'</span><span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_60rpm, <span style="color: #D0372D;">1e9</span><span style="color: #6434A3;">*</span>cumtrapz<span style="color: #7388D6;">(</span>f_60rpm, <span style="color: #909183;">(</span><span style="color: #709870;">(</span>TWf<span style="color: #6434A3;">.*</span>Tfd<span style="color: #709870;">)</span><span style="color: #6434A3;">.^</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">.^</span>.<span style="color: #D0372D;">5</span>, <span style="color: #008000;">'--', 'DisplayName', 'Estimated'</span><span style="color: #707183;">)</span>;
hold off;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'CPS </span><span style="color: #7388D6;">[</span><span style="color: #008000;">$nm$ rms</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
xlim<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>f_60rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span>, f_60rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #008000;">'Location', 'southeast'</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="org705428f" 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 14: </span>Cumulative Power Spectrum - 60rpm</p>
</div>
</div>
</div>
<div id="outline-container-org3f4174a" class="outline-3">
<h3 id="org3f4174a"><span class="section-number-3">4.9</span> Compute the resulting RMS value [m]</h3>
<div class="outline-text-3" id="text-4-9">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #6434A3;">figure</span>;
hold on;
plot<span style="color: #707183;">(</span>f_1rpm, <span style="color: #D0372D;">1e9</span><span style="color: #6434A3;">*</span>cumtrapz<span style="color: #7388D6;">(</span>f_1rpm, <span style="color: #909183;">(</span>pxx_1rpm<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span>, <span style="color: #008000;">'--', 'DisplayName', 'Exp. Data'</span><span style="color: #707183;">)</span>;
plot<span style="color: #707183;">(</span>f_1rpm, <span style="color: #D0372D;">1e9</span><span style="color: #6434A3;">*</span><span style="color: #7388D6;">(</span>f_1rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #6434A3;">-</span>f_1rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">1</span><span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">/</span><span style="color: #7388D6;">(</span>length<span style="color: #909183;">(</span>f_1rpm<span style="color: #909183;">)</span><span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span><span style="color: #7388D6;">)</span><span style="color: #6434A3;">*</span>cumsum<span style="color: #7388D6;">(</span>pxx_1rpm<span style="color: #7388D6;">)</span>, <span style="color: #008000;">'--', 'DisplayName', 'Exp. Data'</span><span style="color: #707183;">)</span>;
hold off;
<span style="color: #6434A3;">set</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">gca</span>, <span style="color: #008000;">'XScale', 'log'</span><span style="color: #707183;">)</span>;
xlabel<span style="color: #707183;">(</span><span style="color: #008000;">'Frequency </span><span style="color: #7388D6;">[</span><span style="color: #008000;">Hz</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span><span style="color: #008000;">; ylabel</span><span style="color: #707183;">(</span><span style="color: #008000;">'CPS </span><span style="color: #7388D6;">[</span><span style="color: #008000;">$nm$ rms</span><span style="color: #7388D6;">]</span><span style="color: #008000;">'</span><span style="color: #707183;">)</span>;
xlim<span style="color: #707183;">(</span><span style="color: #7388D6;">[</span>f_1rpm<span style="color: #909183;">(</span><span style="color: #D0372D;">2</span><span style="color: #909183;">)</span>, f_1rpm<span style="color: #909183;">(</span>end<span style="color: #909183;">)</span><span style="color: #7388D6;">]</span><span style="color: #707183;">)</span>;
legend<span style="color: #707183;">(</span><span style="color: #008000;">'Location', 'southeast'</span><span style="color: #707183;">)</span>;
</pre>
</div>
<div id="orgff0366a" 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 15: </span>Cumulative Power Spectrum - 1rpm</p>
</div>
</div>
</div>
</div>
<div id="outline-container-orgd02ff2d" class="outline-2">
<h2 id="orgd02ff2d"><span class="section-number-2">5</span> Functions</h2>
<div class="outline-text-2" id="text-5">
</div>
<div id="outline-container-orgaa6ae15" class="outline-3">
<h3 id="orgaa6ae15"><span class="section-number-3">5.1</span> getAsynchronousError</h3>
<div class="outline-text-3" id="text-5-1">
<div class="org-src-container">
<pre class="src src-matlab"><span style="color: #0000FF;">function</span> <span style="color: #707183;">[</span><span style="color: #BA36A5;">Wxdec</span><span style="color: #707183;">]</span> = <span style="color: #006699;">getAsynchronousError</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">data</span>, <span style="color: #BA36A5;">NbTurn</span><span style="color: #707183;">)</span>
<span style="color: #8D8D84; font-weight: bold; font-style: italic; text-decoration: overline;">%%</span>
L = length<span style="color: #707183;">(</span>data<span style="color: #707183;">)</span>;
res_per_rev = L<span style="color: #6434A3;">/</span>NbTurn;
P = <span style="color: #D0372D;">0</span><span style="color: #6434A3;">:</span><span style="color: #707183;">(</span>res_per_rev<span style="color: #6434A3;">*</span>NbTurn<span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span><span style="color: #707183;">)</span>;
Pos = P' <span style="color: #6434A3;">*</span> <span style="color: #D0372D;">360</span><span style="color: #6434A3;">/</span>res_per_rev;
<span style="color: #8D8D84; font-style: italic;">% Temperature correction</span>
x1 = myfit2<span style="color: #707183;">(</span>Pos, data<span style="color: #707183;">)</span>;
<span style="color: #8D8D84; font-style: italic;">% Convert data to frequency domain and scale accordingly</span>
X2 = <span style="color: #D0372D;">2</span><span style="color: #6434A3;">/</span><span style="color: #707183;">(</span>res_per_rev<span style="color: #6434A3;">*</span>NbTurn<span style="color: #707183;">)</span><span style="color: #6434A3;">*</span>fft<span style="color: #707183;">(</span>x1<span style="color: #707183;">)</span>;
f2 = <span style="color: #707183;">(</span><span style="color: #D0372D;">0</span><span style="color: #6434A3;">:</span>L<span style="color: #6434A3;">-</span><span style="color: #D0372D;">1</span><span style="color: #707183;">)</span><span style="color: #6434A3;">./</span>NbTurn; <span style="color: #8D8D84; font-style: italic;">%upr -&gt; once per revolution</span>
<span style="color: #8D8D84; font-weight: bold; font-style: italic; text-decoration: overline;">%%</span>
X2dec = zeros<span style="color: #707183;">(</span>size<span style="color: #7388D6;">(</span>X2<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
<span style="color: #8D8D84; font-style: italic;">% Get only the non integer data</span>
X2dec<span style="color: #707183;">(</span>mod<span style="color: #7388D6;">(</span>f2<span style="color: #909183;">(</span><span style="color: #6434A3;">:</span><span style="color: #909183;">)</span>, <span style="color: #D0372D;">1</span><span style="color: #7388D6;">)</span> <span style="color: #6434A3;">~=</span> <span style="color: #D0372D;">0</span><span style="color: #707183;">)</span> = X2<span style="color: #707183;">(</span>mod<span style="color: #7388D6;">(</span>f2<span style="color: #909183;">(</span><span style="color: #6434A3;">:</span><span style="color: #909183;">)</span>, <span style="color: #D0372D;">1</span><span style="color: #7388D6;">)</span> <span style="color: #6434A3;">~=</span> <span style="color: #D0372D;">0</span><span style="color: #707183;">)</span>;
Wxdec = real<span style="color: #707183;">(</span><span style="color: #7388D6;">(</span>res_per_rev<span style="color: #6434A3;">*</span>NbTurn<span style="color: #7388D6;">)</span><span style="color: #6434A3;">/</span><span style="color: #D0372D;">2</span> <span style="color: #6434A3;">*</span> ifft<span style="color: #7388D6;">(</span>X2dec<span style="color: #7388D6;">)</span><span style="color: #707183;">)</span>;
<span style="color: #8D8D84; font-weight: bold; font-style: italic; text-decoration: overline;">%%</span>
<span style="color: #0000FF;">function</span> <span style="color: #BA36A5;">Y</span> = <span style="color: #006699;">myfit2</span><span style="color: #707183;">(</span><span style="color: #BA36A5;">x</span>,<span style="color: #BA36A5;">y</span><span style="color: #707183;">)</span>
A = <span style="color: #707183;">[</span>x ones<span style="color: #7388D6;">(</span>size<span style="color: #909183;">(</span>x<span style="color: #909183;">)</span><span style="color: #7388D6;">)</span><span style="color: #707183;">]</span><span style="color: #6434A3;">\</span>y;
a = A<span style="color: #707183;">(</span><span style="color: #D0372D;">1</span><span style="color: #707183;">)</span>; b = A<span style="color: #707183;">(</span><span style="color: #D0372D;">2</span><span style="color: #707183;">)</span>;
Y = y <span style="color: #6434A3;">-</span> <span style="color: #707183;">(</span>a<span style="color: #6434A3;">*</span>x <span style="color: #6434A3;">+</span> b<span style="color: #707183;">)</span>;
<span style="color: #0000FF;">end</span>
<span style="color: #0000FF;">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-14 jeu. 16:05</p>
<p class="validation"><a href="http://validator.w3.org/check?uri=referer">Validate</a></p>
</div>
</body>
</html>