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;
%% 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"
if tg.Status == "stopped"
%% Load the application
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
f = SimulinkRealTime.openFTP(tg);
mget(f, 'data/data_001.dat');
close(f);
%% Convert the Data
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
t = data(:, end);
x1 = data(:, 1);
x2 = data(:, 2);
ux = data(:, 1);
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
figure;
hold on;
plot(t, x1);
plot(t, x2);
plot(t, ux);
plot(t, uy);
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');
%% Compute the PSD
dt = t(2)-t(1);
window_L = ceil(length(x1)/10);
window_han = .5*(1 - cos(2*pi*(1:window_L)'/(window_L+1)));
[pxx, f] = pwelch(x1, window_han, 0, [], 1/dt);
figure;
hold on;
plot(t, yx);
plot(t, yy);
hold off
xlabel('Time [s]');
ylabel('Voltage [V]');

Binary file not shown.