50 lines
852 B
Mathematica
50 lines
852 B
Mathematica
|
tg = slrt;
|
||
|
|
||
|
%% TODO - Build this application if updated
|
||
|
|
||
|
%%
|
||
|
if tg.Connected == "Yes"
|
||
|
if tg.Status == "stopped"
|
||
|
%% Load the application
|
||
|
tg.load('disturbance_measurement');
|
||
|
|
||
|
%% Run the application
|
||
|
tg.start;
|
||
|
pause(300);
|
||
|
tg.stop;
|
||
|
|
||
|
%% Load the data
|
||
|
f = SimulinkRealTime.openFTP(tg);
|
||
|
cd(f, 'data/disturbance_measurement/');
|
||
|
mget(f, 'data_001.dat', 'data');
|
||
|
close(f);
|
||
|
end
|
||
|
end
|
||
|
|
||
|
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
|
||
|
|
||
|
size(data)
|
||
|
|
||
|
t = data(:, end);
|
||
|
x1 = data(:, 1);
|
||
|
x2 = data(:, 2);
|
||
|
|
||
|
save('mat/data_002.mat', 't', 'x1', 'x2');
|
||
|
|
||
|
%% Plot the data
|
||
|
figure;
|
||
|
hold on;
|
||
|
plot(t, x1);
|
||
|
plot(t, x2);
|
||
|
hold off
|
||
|
xlabel('Time [s]');
|
||
|
ylabel('Voltage [V]');
|
||
|
|
||
|
%%
|
||
|
figure;
|
||
|
hold on;
|
||
|
plot(t, x1-x2);
|
||
|
hold off
|
||
|
xlabel('Time [s]');
|
||
|
ylabel('Voltage [V]');
|