add script to test multiple iff gains
This commit is contained in:
parent
040f2b42cc
commit
a4f91c68e1
54
matlab/test_iff_gains.m
Normal file
54
matlab/test_iff_gains.m
Normal file
@ -0,0 +1,54 @@
|
||||
tg = slrt;
|
||||
|
||||
%% Gains to test
|
||||
g_iff = [0, 1, 5, 10, 50, 100];
|
||||
|
||||
results = {zeros(1, length(g_iff))};
|
||||
|
||||
if tg.Connected == "Yes"
|
||||
|
||||
stop(tg);
|
||||
%% Set Parameters for the Simulation
|
||||
% setparam(tg, 'Noise', 'Variance', 0);
|
||||
setparam(tg, 'Sine', 'Amplitude', 0);
|
||||
setparam(tg, 'DC_value', 'Value', 0);
|
||||
setparam(tg, 'Chirp_gain', 'Gain', 0.03);
|
||||
setparam(tg, 'iff_enable', 'Gain', 1);
|
||||
|
||||
if tg.Status == "stopped"
|
||||
|
||||
for i = 1:length(g_iff)
|
||||
setparam(tg, 'g_iff', 'Gain', g_iff(i));
|
||||
|
||||
fprintf('(%i/%i) - Testing for g_iff = %.1f', i, length(g_iff), g_iff(i));
|
||||
|
||||
start(tg);
|
||||
|
||||
pause(101);
|
||||
|
||||
stop(tg);
|
||||
|
||||
setparam(tg, 'g_iff', 'Gain', 0);
|
||||
|
||||
%%
|
||||
f = SimulinkRealTime.openFTP(tg);
|
||||
mget(f, 'apa95ml.dat', 'data');
|
||||
close(f);
|
||||
|
||||
%% Convert the Data
|
||||
data = SimulinkRealTime.utils.getFileScopeData('data/apa95ml.dat').data;
|
||||
|
||||
u = data(:, 1); % Input Voltage [V]
|
||||
y = data(:, 2); % Output Displacement [m]
|
||||
v = data(:, 3); % Output Voltage (Force Sensor) [V]
|
||||
t = data(:, 4); % Time [s]
|
||||
|
||||
results(i) = {struct('t', t, 'u', u, 'y', y, 'v', v)};
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
save('../mat/apa95ml_iff_test.mat', 'results');
|
||||
%% Best functions
|
||||
% viewTargetScreen(tg);
|
Loading…
Reference in New Issue
Block a user