diff --git a/mat/data_001.mat b/mat/data_001.mat new file mode 100644 index 0000000..90e31cc Binary files /dev/null and b/mat/data_001.mat differ diff --git a/run_test.m b/run_test.m index 2d6cee2..3878584 100644 --- a/run_test.m +++ b/run_test.m @@ -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]'); diff --git a/test_cercalo.slx b/test_cercalo.slx index 23e1900..696615a 100644 Binary files a/test_cercalo.slx and b/test_cercalo.slx differ