test-bench-apa300ml/matlab/frf_save.m

33 lines
736 B
Matlab

% =frf_save.m= - Save Data
% :PROPERTIES:
% :header-args: :tangle matlab/frf_save.m
% :END:
% First, we get data from the Speedgoat:
tg = slrt;
f = SimulinkRealTime.openFTP(tg);
mget(f, 'data/data.dat');
close(f);
% And we load the data on the Workspace:
data = SimulinkRealTime.utils.getFileScopeData('data/data.dat').data;
da = data(:, 1); % Excitation Voltage (input of PD200) [V]
de = data(:, 2); % Measured voltage (force sensor) [V]
Vs = data(:, 3); % Measurment displacement (encoder) [m]
Va = data(:, 4); % Measurement displacement (attocube) [m]
t = data(:, end); % Time [s]
% And we save this to a =mat= file:
apa_number = 1;
save(sprintf('mat/frf_data_%i_huddle.mat', apa_number), 't', 'Va', 'Vs', 'de', 'da');