Browse Source

Work 1: File housekeeping

tags/v1.0
parent
commit
8b25ee6130
30 changed files with 21 additions and 21 deletions
  1. BIN
      Work 1/Choutouridis_Christos_8997_Lab01.zip
  2. BIN
      Work 1/Work1_report.pdf
  3. BIN
      Work 1/report/Work1_report.pdf
  4. +9
    -9
      Work 1/report/Work1_report.tex
  5. BIN
      Work 1/scripts/Prob3a_NoiseStd0.0010.png
  6. BIN
      Work 1/scripts/Prob3a_NoiseStd0.0025.png
  7. BIN
      Work 1/scripts/Prob3c_AmplitudeEffect.png
  8. +3
    -3
      Work 1/scripts/Problem1.m
  9. +2
    -2
      Work 1/scripts/Problem2a.m
  10. +2
    -2
      Work 1/scripts/Problem2b.m
  11. +2
    -2
      Work 1/scripts/Problem3a.m
  12. +1
    -1
      Work 1/scripts/Problem3b.m
  13. +2
    -2
      Work 1/scripts/Problem3c.m
  14. BIN
      Work 1/scripts/output/Prob1_responce_20s.png
  15. BIN
      Work 1/scripts/output/Prob1_responce_90s.png
  16. BIN
      Work 1/scripts/output/Prob2_20s_Ts0.1.png
  17. BIN
      Work 1/scripts/output/Prob2b_20s_Ts0.1.png
  18. +0
    -0
      Work 1/scripts/output/Prob3_Error_vs_Duration.png
  19. +0
    -0
      Work 1/scripts/output/Prob3a_ComparisonPlot.png
  20. +0
    -0
      Work 1/scripts/output/Prob3a_NoiseEffect.png
  21. BIN
      Work 1/scripts/output/Prob3a_NoiseStd0.0010.png
  22. BIN
      Work 1/scripts/output/Prob3a_NoiseStd0.0025.png
  23. BIN
      Work 1/scripts/output/Prob3b_SamplingPeriodEffect.png
  24. BIN
      Work 1/scripts/output/Prob3c_AmplitudeEffect.png
  25. +0
    -0
      Work 1/scripts/output/problem1_data.csv
  26. +0
    -0
      Work 1/scripts/output/problem3_data_T10s.csv
  27. +0
    -0
      Work 1/scripts/output/problem3_data_T20s.csv
  28. +0
    -0
      Work 1/scripts/output/problem3_data_T40s.csv
  29. +0
    -0
      Work 1/scripts/output/problem3_data_T60s.csv
  30. +0
    -0
      Work 1/scripts/output/problem3_data_T90s.csv

BIN
Work 1/Choutouridis_Christos_8997_Lab01.zip View File


BIN
Work 1/Work1_report.pdf View File


BIN
Work 1/report/Work1_report.pdf View File


+ 9
- 9
Work 1/report/Work1_report.tex View File

@@ -89,7 +89,7 @@
\begin{itemize} \begin{itemize}
\item Την παρούσα αναφορά. \item Την παρούσα αναφορά.
\item Τον κατάλογο \textbf{scripts/}, που περιέχει τον κώδικα της MATLAB. \item Τον κατάλογο \textbf{scripts/}, που περιέχει τον κώδικα της MATLAB.
\item Το \href{https://git.hoo2.net/hoo2/SystemModling}{σύνδεσμο} με το αποθετήριο που περιέχει όλο το project με τον κώδικα της MATLAB, της αναφοράς και τα παραδοτέα. \item Το \href{https://git.hoo2.net/hoo2/SystemModling/src/branch/master/Work%201}{σύνδεσμο} με το αποθετήριο που περιέχει όλο το project με τον κώδικα της MATLAB, της αναφοράς και τα παραδοτέα.
\end{itemize} \end{itemize}


\section*{Θέμα 1 – Μοντελοποίηση και Προσομοίωση Συστήματος Εκκρεμούς} \section*{Θέμα 1 – Μοντελοποίηση και Προσομοίωση Συστήματος Εκκρεμούς}
@@ -143,10 +143,10 @@
Για τον λόγο αυτό, επεκτείναμε τη διάρκεια προσομοίωσης στα $90$ δευτερόλεπτα. Για τον λόγο αυτό, επεκτείναμε τη διάρκεια προσομοίωσης στα $90$ δευτερόλεπτα.
Όπως φαίνεται στο Σχήμα~\ref{fig:90s}, το σύστημα σταθεροποιείται τελικά σε περιοδική μορφή περίπου μετά από $50$ δευτερόλεπτα. Όπως φαίνεται στο Σχήμα~\ref{fig:90s}, το σύστημα σταθεροποιείται τελικά σε περιοδική μορφή περίπου μετά από $50$ δευτερόλεπτα.


\InsertFigure{!ht}{1}{fig:20s}{../scripts/Prob1_responce_20s.png}{ \InsertFigure{!ht}{1}{fig:20s}{../scripts/output/Prob1_responce_20s.png}{
Απόκριση του συστήματος για $t \in [0, 20]$ sec. Η μεταβατική φάση παραμένει ενεργή. Απόκριση του συστήματος για $t \in [0, 20]$ sec. Η μεταβατική φάση παραμένει ενεργή.
} }
\InsertFigure{!ht}{1}{fig:90s}{../scripts/Prob1_responce_90s.png}{ \InsertFigure{!ht}{1}{fig:90s}{../scripts/output/Prob1_responce_90s.png}{
Απόκριση του συστήματος για $t \in [0, 90]$ sec. Το σύστημα σταθεροποιείται σε περιοδική συμπεριφορά μετά τα $50$ sec. Απόκριση του συστήματος για $t \in [0, 90]$ sec. Το σύστημα σταθεροποιείται σε περιοδική συμπεριφορά μετά τα $50$ sec.
} }


@@ -187,7 +187,7 @@
\] \]
Στο Σχήμα~\ref{fig:prob2a} παρουσιάζονται η πραγματική και η εκτιμώμενη γωνία, καθώς και το σφάλμα $e_q(t)$ μεταξύ τους. Στο Σχήμα~\ref{fig:prob2a} παρουσιάζονται η πραγματική και η εκτιμώμενη γωνία, καθώς και το σφάλμα $e_q(t)$ μεταξύ τους.


\InsertFigure{!ht}{1}{fig:prob2a}{../scripts/Prob2_20s_Ts0.1.png}{ \InsertFigure{!ht}{1}{fig:prob2a}{../scripts/output/Prob2_20s_Ts0.1.png}{
Αποτελέσματα εκτίμησης παραμέτρων με χρήση όλων των μεταβλητών κατάστασης. Αποτελέσματα εκτίμησης παραμέτρων με χρήση όλων των μεταβλητών κατάστασης.
} }
\paragraph*{Συμπεράσματα:} \paragraph*{Συμπεράσματα:}
@@ -204,7 +204,7 @@
\] \]
Ακολουθείται η ίδια διαδικασία παλινδρόμησης με την περίπτωση (α), όπως και η ανακατασκευή της απόκρισης. Το Σχήμα~\ref{fig:prob2b} δείχνει τα αντίστοιχα αποτελέσματα. Ακολουθείται η ίδια διαδικασία παλινδρόμησης με την περίπτωση (α), όπως και η ανακατασκευή της απόκρισης. Το Σχήμα~\ref{fig:prob2b} δείχνει τα αντίστοιχα αποτελέσματα.


\InsertFigure{!ht}{1}{fig:prob2b}{../scripts/Prob2b_20s_Ts0.1.png}{ \InsertFigure{!ht}{1}{fig:prob2b}{../scripts/output/Prob2b_20s_Ts0.1.png}{
Αποτελέσματα εκτίμησης παραμέτρων με χρήση μόνο του $q(t)$ και του $u(t)$. Αποτελέσματα εκτίμησης παραμέτρων με χρήση μόνο του $q(t)$ και του $u(t)$.
} }


@@ -238,13 +238,13 @@
\hspace{-2em} \hspace{-2em}
\begin{minipage}{0.49\textwidth} \begin{minipage}{0.49\textwidth}
\centering \centering
\includegraphics[width=1.15\linewidth]{../scripts/Prob3a_NoiseStd0.0010.png} \includegraphics[width=1.15\linewidth]{../scripts/output/Prob3a_NoiseStd0.0010.png}
\caption{Εκτίμηση με $\sigma = 0.001$} \caption{Εκτίμηση με $\sigma = 0.001$}
\end{minipage} \end{minipage}
\hspace{0.5em} \hspace{0.5em}
\begin{minipage}{0.49\textwidth} \begin{minipage}{0.49\textwidth}
\centering \centering
\includegraphics[width=1.15\linewidth]{../scripts/Prob3a_NoiseStd0.0025.png} \includegraphics[width=1.15\linewidth]{../scripts/output/Prob3a_NoiseStd0.0025.png}
\caption{Εκτίμηση με $\sigma = 0.0025$} \caption{Εκτίμηση με $\sigma = 0.0025$}
\end{minipage} \end{minipage}
\end{figure} \end{figure}
@@ -280,7 +280,7 @@
\caption{Εκτιμήσεις και ποσοστά σφάλματος παραμέτρων για διαφορετικές περιόδους $T_s$} \caption{Εκτιμήσεις και ποσοστά σφάλματος παραμέτρων για διαφορετικές περιόδους $T_s$}
\end{table} \end{table}


\InsertFigure{!ht}{1}{fig:3b}{../scripts/Prob3b_SamplingPeriodEffect.png}{ \InsertFigure{!ht}{1}{fig:3b}{../scripts/output/Prob3b_SamplingPeriodEffect.png}{
Σφάλμα εκτίμησης ως προς την περίοδο δειγματοληψίας $T_s$. Σφάλμα εκτίμησης ως προς την περίοδο δειγματοληψίας $T_s$.
} }


@@ -319,7 +319,7 @@
\caption{Εκτιμήσεις και ποσοστά σφάλματος παραμέτρων για διαφορετικά πλάτη $A_0$} \caption{Εκτιμήσεις και ποσοστά σφάλματος παραμέτρων για διαφορετικά πλάτη $A_0$}
\end{table} \end{table}


\InsertFigure{!ht}{1}{fig:3c}{../scripts/Prob3c_AmplitudeEffect.png}{ \InsertFigure{!ht}{1}{fig:3c}{../scripts/output/Prob3c_AmplitudeEffect.png}{
Σφάλμα εκτίμησης παραμέτρων συναρτήσει του πλάτους εισόδου $A_0$. Σφάλμα εκτίμησης παραμέτρων συναρτήσει του πλάτους εισόδου $A_0$.
} }




BIN
Work 1/scripts/Prob3a_NoiseStd0.0010.png View File

Before After
Width: 1563  |  Height: 1250  |  Size: 70 KiB

BIN
Work 1/scripts/Prob3a_NoiseStd0.0025.png View File

Before After
Width: 1563  |  Height: 1250  |  Size: 66 KiB

BIN
Work 1/scripts/Prob3c_AmplitudeEffect.png View File

Before After
Width: 1563  |  Height: 938  |  Size: 32 KiB

+ 3
- 3
Work 1/scripts/Problem1.m View File

@@ -28,11 +28,11 @@ subplot(2,1,1);
plot(t, x(:,1)); ylabel('q(t) [rad]'); grid on; title('Γωνία'); plot(t, x(:,1)); ylabel('q(t) [rad]'); grid on; title('Γωνία');
subplot(2,1,2); subplot(2,1,2);
plot(t, x(:,2), 'r'); ylabel('dq(t) [rad/s]'); xlabel('t [sec]'); grid on; title('Γωνιακή Ταχύτητα'); plot(t, x(:,2), 'r'); ylabel('dq(t) [rad/s]'); xlabel('t [sec]'); grid on; title('Γωνιακή Ταχύτητα');
saveas(gcf, 'Prob1_responce_20s.png'); saveas(gcf, 'output/Prob1_responce_20s.png');


% === Sampling for Problem 2 === % === Sampling for Problem 2 ===
Ts = 0.1; % Sampling period Ts = 0.1; % Sampling period
sample_data(t, x, Ts, A0, omega, 'problem1_data.csv'); sample_data(t, x, Ts, A0, omega, 'output/problem1_data.csv');


% --- Extended simulation to 90 sec --- % --- Extended simulation to 90 sec ---
tspan = [0 90]; tspan = [0 90];
@@ -47,4 +47,4 @@ subplot(2,1,1);
plot(t, x(:,1)); ylabel('q(t) [rad]'); grid on; title('Γωνία'); plot(t, x(:,1)); ylabel('q(t) [rad]'); grid on; title('Γωνία');
subplot(2,1,2); subplot(2,1,2);
plot(t, x(:,2), 'r'); ylabel('dq(t) [rad/s]'); xlabel('t [sec]'); grid on; title('Γωνιακή Ταχύτητα'); plot(t, x(:,2), 'r'); ylabel('dq(t) [rad/s]'); xlabel('t [sec]'); grid on; title('Γωνιακή Ταχύτητα');
saveas(gcf, 'Prob1_responce_90s.png'); saveas(gcf, 'output/Prob1_responce_90s.png');

+ 2
- 2
Work 1/scripts/Problem2a.m View File

@@ -12,7 +12,7 @@ mgL_true = m * g * L;
theta_true = [mL2_true; c_true; mgL_true]; theta_true = [mL2_true; c_true; mgL_true];


% Load sampled data from Problem 1 % Load sampled data from Problem 1
data = readtable('problem1_data.csv'); data = readtable('output/problem1_data.csv');
t = data.t; t = data.t;
q = data.q; q = data.q;
dq = data.dq; dq = data.dq;
@@ -73,7 +73,7 @@ bar(["mL^2", "c", "mgL"], theta_hat);
title('Estimated Parameters'); title('Estimated Parameters');
ylabel('Value'); ylabel('Value');
grid on; grid on;
saveas(gcf, 'Prob2_20s_Ts0.1.png'); saveas(gcf, 'output/Prob2_20s_Ts0.1.png');


fprintf(' Actual Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_true(1), theta_true(2), theta_true(3)); fprintf(' Actual Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_true(1), theta_true(2), theta_true(3));
fprintf('Estimated Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_hat(1), theta_hat(2), theta_hat(3)); fprintf('Estimated Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_hat(1), theta_hat(2), theta_hat(3));

+ 2
- 2
Work 1/scripts/Problem2b.m View File

@@ -12,7 +12,7 @@ mgL_true = m * g * L;
theta_true = [mL2_true; c_true; mgL_true]; theta_true = [mL2_true; c_true; mgL_true];


% Load sampled data % Load sampled data
data = readtable('problem1_data.csv'); data = readtable('output/problem1_data.csv');
t = data.t; t = data.t;
q = data.q; q = data.q;
u = data.u; u = data.u;
@@ -81,7 +81,7 @@ ylabel('Value');
grid on; grid on;


% Save figure % Save figure
saveas(gcf, 'Prob2b_20s_Ts0.1.png'); saveas(gcf, 'output/Prob2b_20s_Ts0.1.png');


% Print results % Print results
fprintf(' Actual Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_true(1), theta_true(2), theta_true(3)); fprintf(' Actual Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_true(1), theta_true(2), theta_true(3));


+ 2
- 2
Work 1/scripts/Problem3a.m View File

@@ -13,7 +13,7 @@ mgL_true = m * g * L;
theta_true = [mL2_true; c; mgL_true]; theta_true = [mL2_true; c; mgL_true];


% Load clean data % Load clean data
data = readtable('problem1_data.csv'); data = readtable('output/problem1_data.csv');
t = data.t; t = data.t;
q_clean = data.q; q_clean = data.q;
u = data.u; u = data.u;
@@ -109,6 +109,6 @@ for i = 1:length(noise_levels)
grid on; grid on;


% Save figure % Save figure
filename = sprintf('Prob3a_NoiseStd%.4f.png', noise_std); filename = sprintf('output/Prob3a_NoiseStd%.4f.png', noise_std);
saveas(gcf, filename); saveas(gcf, filename);
end end

+ 1
- 1
Work 1/scripts/Problem3b.m View File

@@ -77,4 +77,4 @@ ylabel('Relative Error [%]');
title('Effect of Ts on Parameter Estimation'); title('Effect of Ts on Parameter Estimation');
grid on; grid on;


saveas(gcf, 'Prob3b_SamplingPeriodEffect.png'); saveas(gcf, 'output/Prob3b_SamplingPeriodEffect.png');

+ 2
- 2
Work 1/scripts/Problem3c.m View File

@@ -19,7 +19,7 @@ dt = 1e-4; % integration resolution
T_final = 20; % simulation time T_final = 20; % simulation time


% Amplitudes to test % Amplitudes to test
A0_list = [1, 2, 4, 6, 8, 16, 32]; A0_list = [1, 2, 4, 6, 8, 16];
n_cases = length(A0_list); n_cases = length(A0_list);
rel_errors_all = zeros(3, n_cases); rel_errors_all = zeros(3, n_cases);


@@ -75,4 +75,4 @@ title('Effect of Input Amplitude on Parameter Estimation');
grid on; grid on;
ylim([0 1.1]); ylim([0 1.1]);


saveas(gcf, 'Prob3c_AmplitudeEffect.png'); saveas(gcf, 'output/Prob3c_AmplitudeEffect.png');

BIN
Work 1/scripts/Prob1_responce_20s.png → Work 1/scripts/output/Prob1_responce_20s.png View File

Before After
Width: 2000  |  Height: 1344  |  Size: 78 KiB Width: 2000  |  Height: 1344  |  Size: 78 KiB

BIN
Work 1/scripts/Prob1_responce_90s.png → Work 1/scripts/output/Prob1_responce_90s.png View File

Before After
Width: 2000  |  Height: 1344  |  Size: 105 KiB Width: 2000  |  Height: 1344  |  Size: 105 KiB

BIN
Work 1/scripts/Prob2_20s_Ts0.1.png → Work 1/scripts/output/Prob2_20s_Ts0.1.png View File

Before After
Width: 2000  |  Height: 1250  |  Size: 72 KiB Width: 2000  |  Height: 1250  |  Size: 72 KiB

BIN
Work 1/scripts/Prob2b_20s_Ts0.1.png → Work 1/scripts/output/Prob2b_20s_Ts0.1.png View File

Before After
Width: 2000  |  Height: 1250  |  Size: 73 KiB Width: 2000  |  Height: 1250  |  Size: 73 KiB

Work 1/scripts/Prob3_Error_vs_Duration.png → Work 1/scripts/output/Prob3_Error_vs_Duration.png View File


Work 1/scripts/Prob3a_ComparisonPlot.png → Work 1/scripts/output/Prob3a_ComparisonPlot.png View File


Work 1/scripts/Prob3a_NoiseEffect.png → Work 1/scripts/output/Prob3a_NoiseEffect.png View File


BIN
Work 1/scripts/output/Prob3a_NoiseStd0.0010.png View File

Before After
Width: 1563  |  Height: 1250  |  Size: 70 KiB

BIN
Work 1/scripts/output/Prob3a_NoiseStd0.0025.png View File

Before After
Width: 1563  |  Height: 1250  |  Size: 66 KiB

BIN
Work 1/scripts/Prob3b_SamplingPeriodEffect.png → Work 1/scripts/output/Prob3b_SamplingPeriodEffect.png View File

Before After
Width: 1563  |  Height: 938  |  Size: 52 KiB Width: 1563  |  Height: 938  |  Size: 52 KiB

BIN
Work 1/scripts/output/Prob3c_AmplitudeEffect.png View File

Before After
Width: 1563  |  Height: 938  |  Size: 32 KiB

Work 1/scripts/problem1_data.csv → Work 1/scripts/output/problem1_data.csv View File


Work 1/scripts/problem3_data_T10s.csv → Work 1/scripts/output/problem3_data_T10s.csv View File


Work 1/scripts/problem3_data_T20s.csv → Work 1/scripts/output/problem3_data_T20s.csv View File


Work 1/scripts/problem3_data_T40s.csv → Work 1/scripts/output/problem3_data_T40s.csv View File


Work 1/scripts/problem3_data_T60s.csv → Work 1/scripts/output/problem3_data_T60s.csv View File


Work 1/scripts/problem3_data_T90s.csv → Work 1/scripts/output/problem3_data_T90s.csv View File


||||||
x
 
000:0
Loading…
Cancel
Save