Compare commits

..

2 Commits

Author SHA1 Message Date
tdehaeze 87a17bff73 measure apa stroke 2021-03-16 11:48:57 +01:00
tdehaeze 0a848276c7 add simulink file for testing apa stroke 2021-03-16 11:48:50 +01:00
18 changed files with 49 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+25
View File
@@ -0,0 +1,25 @@
%%
tg = slrt;
f = SimulinkRealTime.openFTP(tg);
mget(f, 'data/data.dat');
close(f);
%% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/data.dat').data;
V = data(:, 1);
d = data(:, 2)*1000e-6/3.333;
t = data(:, end);
%% Save
save('mat/stroke_apa_1stacks_2.mat', 't', 'V', 'd');
%%
d = d - mean(d(t > 1.9 & t < 2.0));
figure;
plot(t, d)
figure;
plot(V, d)
+24
View File
@@ -0,0 +1,24 @@
Fs = 10e3; % [Hz]
Ts = 1/Fs; % [s]
%%
freq_LPF = 0.5; % [Hz]
s = tf('s');
G_lpf = (1)/(1 + s/2/pi/freq_LPF);
Gz = c2d(G_lpf, Ts, 'tustin');
%%
t = 0:Ts:12;
V = -1*ones(size(t));
t0 = 2; t1 = t0 + 1;
V(t < t0-1) = 0;
V(t > t0 & t < t0 + pi) = 3.25 + 4.25*cos(t(t > t0 & t < t0 + pi) - t0 + pi);
V(t > t0 + pi & t < t1 + pi) = 7.5;
V(t > t1 + pi & t < t1 + 2*pi) = 3.25 + 4.25*cos(t(t > t1 + pi & t < t1 + 2*pi) - t1 + pi);
V(t > t1 + 2*pi + 2) = 0;
w0 = 2*pi*10; xi = 1;
V = lsim(1/(1 + 2*xi*s/w0 + s^2/w0^2), V, t);
Vin = [t', V];
Binary file not shown.
Binary file not shown.