test-bench-apa/index.html

154 lines
4.7 KiB
HTML
Raw Normal View History

2020-07-17 11:56:08 +02: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>
<!-- 2020-07-17 ven. 11:55 -->
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>Test Bench APA</title>
<meta name="generator" content="Org mode" />
<meta name="author" content="Dehaeze Thomas" />
<link rel="stylesheet" type="text/css" href="../css/htmlize.css"/>
<link rel="stylesheet" type="text/css" href="../css/readtheorg.css"/>
<link rel="stylesheet" type="text/css" href="../css/zenburn.css"/>
<script type="text/javascript" src="../js/jquery.min.js"></script>
<script type="text/javascript" src="../js/bootstrap.min.js"></script>
<script type="text/javascript" src="../js/jquery.stickytableheaders.min.js"></script>
<script type="text/javascript" src="../js/readtheorg.js"></script>
</head>
<body>
<div id="org-div-home-and-up">
<a accesskey="h" href="../index.html"> UP </a>
|
<a accesskey="H" href="../index.html"> HOME </a>
</div><div id="content">
<h1 class="title">Test Bench APA</h1>
<div id="table-of-contents">
<h2>Table of Contents</h2>
<div id="text-table-of-contents">
<ul>
<li><a href="#orgf243093">1. Parameters</a></li>
<li><a href="#org523b657">2. Filter White Noise</a></li>
<li><a href="#org422b8fd">3. Load Data</a></li>
<li><a href="#orgbbba70f">4. Time Domain Data</a></li>
<li><a href="#org14d27d9">5. Compute TF estimate and Coherence</a></li>
<li><a href="#orgf7c6889">6. Coherence</a></li>
<li><a href="#org2153f21">7. Transfer Function</a></li>
</ul>
</div>
</div>
<div id="outline-container-orgf243093" class="outline-2">
<h2 id="orgf243093"><span class="section-number-2">1</span> Parameters</h2>
<div class="outline-text-2" id="text-1">
<div class="org-src-container">
<pre class="src src-matlab">Ts = 1e-4;
</pre>
</div>
</div>
</div>
<div id="outline-container-org523b657" class="outline-2">
<h2 id="org523b657"><span class="section-number-2">2</span> Filter White Noise</h2>
<div class="outline-text-2" id="text-2">
<div class="org-src-container">
<pre class="src src-matlab">Glpf = 1/(1 + s/2/pi/500);
Gz = c2d(Glpf, Ts, 'tustin');
</pre>
</div>
</div>
</div>
<div id="outline-container-org422b8fd" class="outline-2">
<h2 id="org422b8fd"><span class="section-number-2">3</span> Load Data</h2>
<div class="outline-text-2" id="text-3">
<div class="org-src-container">
<pre class="src src-matlab">data = SimulinkRealTime.utils.getFileScopeData('data/apa95ml_5kg.dat').data;
</pre>
</div>
</div>
</div>
<div id="outline-container-orgbbba70f" class="outline-2">
<h2 id="orgbbba70f"><span class="section-number-2">4</span> Time Domain Data</h2>
<div class="outline-text-2" id="text-4">
<div class="org-src-container">
<pre class="src src-matlab">figure;
subplot(1,2,1);
plot(data(:, 3), data(:, 1))
ylabel('Input Voltage [V]'); xlabel('Time [s]');
subplot(1,2,2);
plot(data(:, 3), data(:, 2))
ylabel('Output Displacement [m]'); xlabel('Time [s]');
</pre>
</div>
</div>
</div>
<div id="outline-container-org14d27d9" class="outline-2">
<h2 id="org14d27d9"><span class="section-number-2">5</span> Compute TF estimate and Coherence</h2>
<div class="outline-text-2" id="text-5">
<div class="org-src-container">
<pre class="src src-matlab">win = hann(ceil(1/Ts));
[tf_est, f] = tfestimate(data(:, 1), -data(:, 2), win, [], [], 1/Ts);
[co_est, ~] = mscohere( data(:, 1), -data(:, 2), win, [], [], 1/Ts);
</pre>
</div>
</div>
</div>
<div id="outline-container-orgf7c6889" class="outline-2">
<h2 id="orgf7c6889"><span class="section-number-2">6</span> Coherence</h2>
<div class="outline-text-2" id="text-6">
<div class="org-src-container">
<pre class="src src-matlab">figure;
hold on;
plot(f, co_est, 'k-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Coherence'); xlabel('Frequency [Hz]');
hold off;
</pre>
</div>
</div>
</div>
<div id="outline-container-org2153f21" class="outline-2">
<h2 id="org2153f21"><span class="section-number-2">7</span> Transfer Function</h2>
<div class="outline-text-2" id="text-7">
<div class="org-src-container">
<pre class="src src-matlab">figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f, abs(tf_est), 'k-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'log');
ylabel('Amplitude'); xlabel('Frequency [Hz]');
hold off;
ax2 = subplot(2, 1, 2);
hold on;
plot(f, 180/pi*angle(tf_est), 'k-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
legend();
hold off;
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);
</pre>
</div>
</div>
</div>
</div>
<div id="postamble" class="status">
<p class="author">Author: Dehaeze Thomas</p>
<p class="date">Created: 2020-07-17 ven. 11:55</p>
</div>
</body>
</html>