-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTXTreadAngles.m
41 lines (34 loc) · 897 Bytes
/
TXTreadAngles.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
% Remove variables, clear Command Window and close any figures
clear;
clc;
close all;
% Change these to properly locate the txt file you want to plot
filename = 'Angles.txt';
config_type = 'Release';
build_dir = 'build';
path = sprintf('%s/%s/%s', build_dir, config_type, filename);
% Read txt
data = readmatrix(path);
% Get matrix sizes
datasize = size(data);
iterations = datasize(1);
statenumber = datasize(2);
% Define axis variables
Xaxis = []; XaxisRef = [];
Yaxis = []; YaxisRef = [];
% Assigning values
for i = 1 : iterations
XaxisRef = [XaxisRef i];
YaxisRef = [YaxisRef data(i,1)];
Xaxis = [Xaxis,linspace(i,i,statenumber-1)];
Yaxis = [Yaxis,data(i,2:statenumber)];
end
% Plot the values
hold on;
axes = gca;
axes.XLim = [0 iterations];
axes.YLim = [0 2*pi];
xlabel('Iteration')
ylabel('Angle [rad]')
scatter(Xaxis,Yaxis,'b','.')
scatter(XaxisRef,YaxisRef,'r','.')