Work 1: File housekeeping

This commit is contained in:
2025-04-04 00:46:41 +03:00
parent d93dd0f967
commit 8b25ee6130
30 changed files with 21 additions and 21 deletions
Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

+3 -3
View File
@@ -28,11 +28,11 @@ subplot(2,1,1);
plot(t, x(:,1)); ylabel('q(t) [rad]'); grid on; title('Γωνία');
subplot(2,1,2);
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 ===
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 ---
tspan = [0 90];
@@ -47,4 +47,4 @@ subplot(2,1,1);
plot(t, x(:,1)); ylabel('q(t) [rad]'); grid on; title('Γωνία');
subplot(2,1,2);
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
View File
@@ -12,7 +12,7 @@ mgL_true = m * g * L;
theta_true = [mL2_true; c_true; mgL_true];
% Load sampled data from Problem 1
data = readtable('problem1_data.csv');
data = readtable('output/problem1_data.csv');
t = data.t;
q = data.q;
dq = data.dq;
@@ -73,7 +73,7 @@ bar(["mL^2", "c", "mgL"], theta_hat);
title('Estimated Parameters');
ylabel('Value');
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('Estimated Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_hat(1), theta_hat(2), theta_hat(3));
+2 -2
View File
@@ -12,7 +12,7 @@ mgL_true = m * g * L;
theta_true = [mL2_true; c_true; mgL_true];
% Load sampled data
data = readtable('problem1_data.csv');
data = readtable('output/problem1_data.csv');
t = data.t;
q = data.q;
u = data.u;
@@ -81,7 +81,7 @@ ylabel('Value');
grid on;
% Save figure
saveas(gcf, 'Prob2b_20s_Ts0.1.png');
saveas(gcf, 'output/Prob2b_20s_Ts0.1.png');
% Print results
fprintf(' Actual Parameters: mL^2=%f, c=%f, mgL=%f\n', theta_true(1), theta_true(2), theta_true(3));
+2 -2
View File
@@ -13,7 +13,7 @@ mgL_true = m * g * L;
theta_true = [mL2_true; c; mgL_true];
% Load clean data
data = readtable('problem1_data.csv');
data = readtable('output/problem1_data.csv');
t = data.t;
q_clean = data.q;
u = data.u;
@@ -109,6 +109,6 @@ for i = 1:length(noise_levels)
grid on;
% Save figure
filename = sprintf('Prob3a_NoiseStd%.4f.png', noise_std);
filename = sprintf('output/Prob3a_NoiseStd%.4f.png', noise_std);
saveas(gcf, filename);
end
+1 -1
View File
@@ -77,4 +77,4 @@ ylabel('Relative Error [%]');
title('Effect of Ts on Parameter Estimation');
grid on;
saveas(gcf, 'Prob3b_SamplingPeriodEffect.png');
saveas(gcf, 'output/Prob3b_SamplingPeriodEffect.png');
+2 -2
View File
@@ -19,7 +19,7 @@ dt = 1e-4; % integration resolution
T_final = 20; % simulation time
% 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);
rel_errors_all = zeros(3, n_cases);
@@ -75,4 +75,4 @@ title('Effect of Input Amplitude on Parameter Estimation');
grid on;
ylim([0 1.1]);
saveas(gcf, 'Prob3c_AmplitudeEffect.png');
saveas(gcf, 'output/Prob3c_AmplitudeEffect.png');
Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 KiB

After

Width:  |  Height:  |  Size: 105 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 73 KiB

After

Width:  |  Height:  |  Size: 73 KiB

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before

Width:  |  Height:  |  Size: 68 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 52 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB