add documentation and data file
This commit is contained in:
BIN
slip-ring-test/mat/data_001.mat
Normal file
BIN
slip-ring-test/mat/data_001.mat
Normal file
Binary file not shown.
1
slip-ring-test/readme.org
Normal file
1
slip-ring-test/readme.org
Normal file
@@ -0,0 +1 @@
|
||||
* TODO Register data on the computer
|
48
slip-ring-test/run_test.m
Normal file
48
slip-ring-test/run_test.m
Normal file
@@ -0,0 +1,48 @@
|
||||
tg = slrt;
|
||||
|
||||
%% TODO - Build this application if updated
|
||||
|
||||
%%
|
||||
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
|
||||
|
||||
%% Convert the Data
|
||||
data = SimulinkRealTime.utils.getFileScopeData('data/data_001.dat').data;
|
||||
|
||||
t = data(:, end);
|
||||
x1 = data(:, 1);
|
||||
x2 = data(:, 2);
|
||||
|
||||
save('mat/data_001.mat', 't', 'x1', 'x2');
|
||||
|
||||
%% Plot the data
|
||||
figure;
|
||||
hold on;
|
||||
plot(t, x1);
|
||||
plot(t, x2);
|
||||
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);
|
||||
|
Binary file not shown.
Reference in New Issue
Block a user