Contents
Aaron Klapheck
clear, clc, home
fprintf('The date and time: %s \n', datestr(now))
The date and time: 18-Mar-2008 15:56:35
Tasks 2
Solve 8.29
clear, clc, home
fprintf('The date and time: %s \n \n', datestr(now))
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: Solve 8.29 %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
fprintf('\nRead a file called Resistance.dat \n \n')
fileID1 = fopen('Resistance.dat', 'r');
Re = fscanf(fileID1, '%g', [1,9]);
fclose(fileID1);
fprintf('Read a file called voltage.dat \n \n')
fileID2 = fopen('voltage.dat', 'r');
Vol = fscanf(fileID2, '%g', [1,5]);
fclose(fileID2);
[i] = Current(Vol, Re);
A = [[1;2;3;4] i];
fprintf('\t current \n')
fprintf('number value(miliamps) \n')
fprintf('------------------------- \n')
fprintf('%4.0f \t %10.4f \n', A')
fprintf('\n')
The date and time: 18-Mar-2008 15:56:35
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: Solve 8.29 %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Read a file called Resistance.dat
Read a file called voltage.dat
current
number value(miliamps)
-------------------------
1 -1.3546
2 -1.0274
3 -1.2632
4 -0.7896
Solve 8.10 (d, f, h)
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
disp('% %')
disp('% Purpose: Solve 8.10 (d, f, h) %')
disp('% Programer: Aaron Klapheck %')
disp('% %')
disp('%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%')
D = [1, 0; 0, 0];
d = [0; 0];
F = [1, 1; 1, 0; 0, 1];
f = [1; -1; -1];
H = [1, 2, -3, 1; 0, 1, -2, 1; 1, 0, 1, -1];
h = [-1; 2; 1];
J = [1, 4; 3, 9];
j = [3; 8];
fprintf('\nSolution for 8.10(d) \n')
solveMatrix(D,d);
fprintf('\nSolution for 8.10(f) \n')
solveMatrix(F,f);
fprintf('\nSolution for 8.10(h) \n')
solveMatrix(H,h);
fprintf('\nSolution for 8.10 Aarons system 1 \n')
solveMatrix(J,j);
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% %
% Purpose: Solve 8.10 (d, f, h) %
% Programer: Aaron Klapheck %
% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Solution for 8.10(d)
Rank of A is: 1
Rank of [A b] is: 1
Number of unknows: 2
system is consistent.
system is not unique therefore there is no solution.
Solution for 8.10(f)
Rank of A is: 2
Rank of [A b] is: 3
Number of unknows: 2
system is not consistent.
system is unique.
system has no solutions because
there are more independant equations than unknows.
Solution for 8.10(h)
Rank of A is: 2
Rank of [A b] is: 3
Number of unknows: 4
system is not consistent.
system is not unique therefore there is no solution.
Solution for 8.10 Aarons system 1
Rank of A is: 2
Rank of [A b] is: 2
Number of unknows: 2
system is consistent.
system is unique.
Solution is: 1.666667
Solution is: 0.333333