Create Matlab file / Tangle scripts / Add CSS

This commit is contained in:
2020-11-10 12:36:41 +01:00
parent 08cb2b8daa
commit ce10736dda
42 changed files with 803 additions and 1753 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
matlab/mat/dac_adc.mat Normal file

Binary file not shown.

BIN
matlab/mat/pi_505_high.mat Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
matlab/mat/pi_505_low.mat Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
matlab/piezo_amplifier.slx Normal file

Binary file not shown.

60
matlab/runtest.m Normal file
View File

@@ -0,0 +1,60 @@
tg = slrt;
%%
f = SimulinkRealTime.openFTP(tg);
mget(f, 'apa95ml.dat', 'data');
close(f);
%% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/apa95ml.dat').data;
V_in = data(:, 1);
V_out = data(:, 2);
t = data(:, 3);
%% Save Data
save('mat/cedrat_la75b_med_3_stack.mat', 't', 'V_in', 'V_out');
%%
run setup;
win = hann(ceil(10/Ts));
[tf_est, f] = tfestimate(V_in, V_out, win, [], [], 1/Ts);
[co_est, ~] = mscohere(V_in, V_out, win, [], [], 1/Ts);
%%
figure;
hold on;
plot(f, co_est, 'k-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Coherence'); xlabel('Frequency [Hz]');
hold off;
%%
figure;
ax1 = subplot(2, 1, 1);
hold on;
plot(f, abs(tf_est), 'k-', 'DisplayName', 'Identified')
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*unwrap(angle(tf_est)), 'k-')
set(gca, 'Xscale', 'log'); set(gca, 'Yscale', 'lin');
ylabel('Phase'); xlabel('Frequency [Hz]');
hold off;
linkaxes([ax1,ax2], 'x');
xlim([10, 5000]);
%%
run setup;
win = hann(ceil(1/Ts));
[tf_est, f] = tfestimate(u, um, win, [], [], 1/Ts);
[co_est, ~] = mscohere(u, um, win, [], [], 1/Ts);

6
matlab/setup.m Normal file
View File

@@ -0,0 +1,6 @@
s = tf('s');
Ts = 1e-4;
Glpf = 1/(1 + s/2/pi/500);
Gz = c2d(Glpf, Ts, 'tustin');

Binary file not shown.