first identification

This commit is contained in:
Thomas Dehaeze 2019-09-10 16:05:05 +02:00
parent 27f8efb98f
commit 298d45a110
3 changed files with 29 additions and 29 deletions

BIN
mat/data_001.mat Normal file

Binary file not shown.

View File

@ -1,47 +1,47 @@
tg = slrt; tg = slrt;
%% TODO - Build this application if updated %%
% if tg.Connected == "Yes"
% if tg.Status == "stopped"
% %% Load the application
% tg.load('test_cercalo');
%
% %% Run the application
% tg.start;
% pause(10);
% tg.stop;
% end
% end
%% %%
if tg.Connected == "Yes" f = SimulinkRealTime.openFTP(tg);
if tg.Status == "stopped" mget(f, 'data/data_001.dat');
%% Load the application close(f);
tg.load('test');
%% Run the application
tg.start;
pause(10);
tg.stop;
%% Load the data
f = SimulinkRealTime.openFTP(tg);
mget(f, 'data/data_001.dat');
close(f);
end
end
%% Convert the Data %% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data; data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
t = data(:, end); t = data(:, end);
x1 = data(:, 1); ux = data(:, 1);
x2 = data(:, 2); uy = data(:, 2);
yx = data(:, 3);
yy = data(:, 4);
save('mat/data_003.mat', 't', 'x1', 'x2'); save('mat/data_001.mat', 't', 'ux', 'uy', 'yx', 'yy');
%% Plot the data %% Plot the data
figure; figure;
hold on; hold on;
plot(t, x1); plot(t, ux);
plot(t, x2); plot(t, uy);
hold off hold off
xlabel('Time [s]'); xlabel('Time [s]');
ylabel('Voltage [V]'); ylabel('Voltage [V]');
%% Compute the PSD figure;
dt = t(2)-t(1); hold on;
plot(t, yx);
window_L = ceil(length(x1)/10); plot(t, yy);
window_han = .5*(1 - cos(2*pi*(1:window_L)'/(window_L+1))); hold off
xlabel('Time [s]');
[pxx, f] = pwelch(x1, window_han, 0, [], 1/dt); ylabel('Voltage [V]');

Binary file not shown.