2024-08-13 11:45:36 +02:00
|
|
|
function plot_error(t,ref,x)
|
2024-08-31 13:31:17 +02:00
|
|
|
hold on
|
2024-08-13 11:45:36 +02:00
|
|
|
|
|
|
|
ex = ref(:, 1) - x(:, 1);
|
|
|
|
ey = ref(:, 2) - x(:, 2);
|
|
|
|
|
|
|
|
error_norm = sqrt(ex.*ex + ey.*ey);
|
2024-09-07 09:43:08 +02:00
|
|
|
plot(t, error_norm, 'Linewidth', 8, 'DisplayName', 'norm of error [m]');
|
2024-08-13 11:45:36 +02:00
|
|
|
|
2024-08-31 13:31:17 +02:00
|
|
|
avg = ones(1, length(error_norm)) * error_norm / length(error_norm);
|
2024-09-07 09:43:08 +02:00
|
|
|
plot(t, avg*ones(1, length(error_norm)), 'DisplayName', 'average error [m]', 'LineWidth', 4);
|
2024-08-13 11:45:36 +02:00
|
|
|
|
|
|
|
Axes = gca;
|
2024-09-07 09:43:08 +02:00
|
|
|
Axes.FontSize=22;
|
2024-08-13 11:45:36 +02:00
|
|
|
Axes.FontWeight='bold';
|
|
|
|
Axes.PlotBoxAspectRatio = [1 1 1];
|
|
|
|
grid minor;
|
|
|
|
|
2024-09-07 09:43:08 +02:00
|
|
|
legend('FontSize', 22, 'Location', 'northeast', 'AutoUpdate','off')
|
|
|
|
xlabel("\textbf{t [s]}", FontSize=22, Interpreter="latex")
|
|
|
|
ylabel("\textbf{tracking error}", FontSize=22, Interpreter="latex")
|
2024-08-13 11:45:36 +02:00
|
|
|
|
2024-08-31 13:31:17 +02:00
|
|
|
hold off
|
2024-08-13 11:45:36 +02:00
|
|
|
end
|