Contents
Aaron Klapheck
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 18-Mar-2008 16:12:04
1. Test 2 Number 1
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: Test 2 Number 1. %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
fprintf('\npart a. \n \n')
A = [1, 1, 0; 1, 0, 1; 0, 1, 1; 1, 1, 1];
b = [1; -2; 0; 4];
solveMatrix(A,b);
fprintf('\npart b. and c. \n \n')
writeToFile('Steady.dat','No, I do not agree with student B.','Because there are more independant equations than unknows')
The date and time: 18-Mar-2008 16:12:04
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: Test 2 Number 1. %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
part a.
Rank of A is: 3
Rank of [A b] is: 4
Number of unknows: 3
system is not consistent.
system is unique.
system has no solutions because
there are more independant equations than unknows.
part b. and c.
Write to a file called Steady.dat
File Steady.dat opened/created sucessfully
File Steady.dat closed succesfully
2. Test 2 Number 2
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: Test 2 Number 2. %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
mA = [1, 1, 0; 0, 1, 1; 1, 0, 1; 1, 1, 1];
mb = [1; -2; 0; 4];
for k = 1:4
if k == 1
A = [mA(2, :); mA(3, :); mA(4, :)];
b = [mb(2, 1); mb(3, 1); mb(4, 1)];
elseif k == 2
A = [mA(1, :); mA(3, :); mA(4, :)];
b = [mb(1, 1); mb(3, 1); mb(4, 1)];
elseif k == 3
A = [mA(1, :); mA(2, :); mA(4, :)];
b = [mb(1, 1); mb(2, 1); mb(4, 1)];
else
A = [mA(1, :); mA(2, :); mA(3, :)];
b = [mb(1, 1); mb(2, 1); mb(3, 1)];
end
x = Gauss(A,b);
Ideal(x)
end
fprintf('\nDeleting equation 3 makes the system unique \n')
writeToFile2('Steady.dat','Deleting equation 3 makes makes the system unique')
The date and time: 18-Mar-2008 16:12:04
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: Test 2 Number 2. %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Not Ideal
Not Ideal
Ideal
Not Ideal
Deleting equation 3 makes the system unique
Write to a file called Steady.dat
File Steady.dat opened/created sucessfully
File Steady.dat closed succesfully
3. Test 2 Number 3
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: Test 2 Number 3. %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
[c1, c2, c3, r1, r2, r3] = demoTcouple();
fprintf('\n')
fprintf('Order of Polynomial \t Polynomial Coefficients \t Accuracy Analysis \t Conclusion \n');
fprintf(' 1 '); fprintf(' %12.5e',fliplr(c1)); fprintf(' %8.5f',norm(r1,inf)); fprintf(' Worst fit'); fprintf('\n');
fprintf(' 2 '); fprintf(' %12.5e',fliplr(c2)); fprintf(' %8.5f',norm(r2,inf)); fprintf(' Alright fit'); fprintf('\n');
fprintf(' 3 '); fprintf(' %12.5e',fliplr(c3)); fprintf(' %8.5f',norm(r3,inf)); fprintf(' Best fit'); fprintf('\n');
The date and time: 18-Mar-2008 16:12:04
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: Test 2 Number 3. %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Curve fit coefficients
constant emf emf^2 emf^3
linear 2.30674e+000 -4.42432e+000
quadratic 2.63770e+000 -1.23509e+001 2.68715e+001
cubic 2.86004e+000 -2.20302e+001 1.09296e+002 -1.80437e+002
Residuals
||r||_2 max error
linear 0.76000 0.43750
quadratic 0.37329 0.18733
cubic 0.18354 0.10922
Order of Polynomial Polynomial Coefficients Accuracy Analysis Conclusion
1 2.30674e+000 -4.42432e+000 0.43750 Worst fit
2 2.63770e+000 -1.23509e+001 2.68715e+001 0.18733 Alright fit
3 2.86004e+000 -2.20302e+001 1.09296e+002 -1.80437e+002 0.10922 Best fit