Skip to content
Snippets Groups Projects
Commit cd4f8eb8 authored by Sebastian Schwarz's avatar Sebastian Schwarz
Browse files

improved notebook V01.1.ipynb

parent 569fa7d0
No related branches found
No related tags found
No related merge requests found
%% Cell type:markdown id:04105e65-6705-4c92-a009-48c54bd38ad4 tags:
# <span style='color:OrangeRed'>V1 DAS ABTASTTHEOREM </span>
%% Cell type:markdown id:ffe7d73f-7986-44b6-a9fd-a678b9aaa182 tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Hier wird analysiert, wie man die geeignete Abtastfrequenz für ein bestimmtes System auswählt. Am Ende überprüfen wir das Ergebnis mit einer einfachen Simulation.
%% Cell type:code id:3a336fb9-2f73-44ce-ab67-91b96ccfc1c1 tags:
``` octave
% Necessary to use control toolbox
pkg load control
clear all
% Set the Octsim Engine to run the simulation
addpath('../Octsim');
```
%% Cell type:markdown id:53866cc1-a0ea-4d77-8d9c-c8345704d874 tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Es ist das folgende System in Form einer Übertragungsfunktion gegeben:
%% Cell type:code id:a0b9d775-f176-483e-aaca-43da284aa2e4 tags:
``` octave
num = [100]
den = [1 10 100]
G = tf(num,den)
```
%% Output
num = 100
den =
1 10 100
Transfer function 'G' from input 'u1' to output ...
100
y1: ----------------
s^2 + 10 s + 100
Continuous-time model.
%% Cell type:markdown id:1cb98bc6-138b-45bc-9178-74f8493d4171 tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Berechnet man die Nullstellen des Nenners, erhält man die Pole des Systems:
%% Cell type:code id:03459a21-1072-416b-a04b-5de7b9a30813 tags:
``` octave
p = roots(den)
```
%% Output
p =
-5.0000 + 8.6603i
-5.0000 - 8.6603i
%% Cell type:markdown id:071800da-0e16-4189-bb65-5746c0415165 tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Aus den Polen berechnen wir die Zeitkonstanten:
%% Cell type:code id:5adb101b-4286-428a-a4bd-eeb57e860e9c tags:
``` octave
tau = -1/real(p)
tau = -1./real(p)
```
%% Output
tau =
0.100000 0.100000
%% Cell type:markdown id:eae75561-2795-400d-802d-f649281ff316 tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
und aus den Zeitkonstanten die Eigenfrequenzen:
%% Cell type:code id:acf57137-23eb-4be3-87ef-eb9d08076f07 tags:
``` octave
om = 2*pi./tau
```
%% Output
om =
62.832 62.832
%% Cell type:markdown id:ab36a55a-6239-4214-9d36-85f4d111c61e tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Die minimale Abtastfrequenz ist durch das Zweifache der maximalen Eigenfrequenz des Systems gegeben.
%% Cell type:code id:c4c1fce4-7677-40d3-813e-5a5e4758f00f tags:
``` octave
minomt = 2*max(om)
```
%% Output
minomt = 125.66
%% Cell type:markdown id:c5fb33ea-47d7-49bf-a8ce-f1d81917a1d0 tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Wir wählen dann einen Wert, der größer ist als das Minimum durch den Koeffizienten K.
%% Cell type:code id:14c39a24-fc50-4924-8075-84125990776f tags:
``` octave
K = 2
omt = K*minomt
```
%% Output
K = 2
omt = 251.33
%% Cell type:markdown id:25ea2215-45ca-4980-a862-372d0eccf237 tags:
<div style="font-family: 'times'; font-size: 13pt; text-align: justify">
Schließlich testen wir die Wahl der Abtastzeit, indem wir die Sprungantwort simulieren und den Ausgang abtasten.
%% Cell type:code id:578daff8-f4fd-4001-bb09-aea89d809eec tags:
``` octave
addpath("../Octsim");
tini = 0 # Start time
tfinal = 3 # End time
dt = 0.001 # Time Step
nflows = 3 #Number of data flows in the schematic, Zahlenwert entspricht nicht dem in Matlab (hier um 1 größer)
Ts = 2*pi/omt # Sampling time for discrete time
c1{1} = StepSource(1,0,1,0.1); #StepSource(self,out,startv,endv,ts)
c1{2} = TransferFunction(1,2,num,den); #TransferFunction(self,inp,out,num,den)
c1{3} = DTTransferFunction(2,3,1,1,Ts); #DTTransferFunction(self,inp,out,num,den,Ts)
% Instance of the simulation schematic
sc1 = Schema(tini,tfinal,dt,nflows);
sc1.AddListComponents(c1);
% Run the schematic and plot
out1 = sc1.Run([1 2 3]);
plot(out1(1,:),out1(2,:),out1(1,:),out1(3,:),out1(1,:),out1(4,:));
```
%% Output
tini = 0
tfinal = 3
dt = 0.0010000
nflows = 3
Ts = 0.025000
%% Cell type:code id:9e1a668f-07ac-442a-bb62-950dacd49832 tags:
``` octave
```
%% Cell type:code id:65f46b62-e607-456a-80b6-42f452d0abfc tags:
``` octave
```
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment