This commit is contained in:
lda committed 2025-06-07 20:09:06 +00:00
1 parent 1130861fe2
commit e7c5e46421
2 files changed
+47

No files matched your search

+3
View File
@@ -35,3 +35,6 @@ codegen/
# buildtool cache folder
.buildtool/
.tmp
+44
View File
@@ -0,0 +1,44 @@
%% Exercise 1. Find the eigenvalues and eigenvectors of the following matrix
% (2 1)
% (1 2)
A_eig = [2 1; 1 2];
% Compute eigenvalues (D) and eigenvectors (V)
[V, D] = eig(A_eig);
fprintf('Eigenvalues and Eigenvectors of matrix A:\n');
fprintf('Eigenvalues (diagonal of D):\n');
disp(diag(D));
fprintf('Eigenvectors (columns of V):\n');
disp(V);
%% Exercise 2. Plot data
T_celsius = [5 20 30 50 55]; % Temperature (C)
mu = [0.08 0.015 0.009 0.006 0.0055]; % Viscosity (mu)
% Plot with '*' mode
figure;
plot(T_celsius, mu, '*');
xlabel('Temperature (C)');
ylabel('Viscosity (mu)');
title('Viscosity vs. Temperature (Marker: *)');
grid on;
% Plot with 'o' mode
figure;
plot(T_celsius, mu, 'o');
xlabel('Temperature (C)');
ylabel('Viscosity (mu)');
title('Viscosity vs. Temperature (Marker: o)');
grid on;
% Plot with '.' mode
figure;
plot(T_celsius, mu, '.');
xlabel('Temperature (C)');
ylabel('Viscosity (mu)');
title('Viscosity vs. Temperature (Marker: .)');
grid on;