Contents
Aaron Klapheck
clear, clc
date
ans =
17-Dec-2007
Chapter 6
Problem 6
A = [2, 1; 3, -9]; b = [5; 2];
X = A\b
should_be_b = A*X
A = [-8, -5; -2, 7]; b = [4; 10];
X = A\b
should_be_b = A*X
X =
2.2381
0.5238
should_be_b =
5
2
X =
-1.1818
1.0909
should_be_b =
4.0000
10.0000
Problem 8
A = [-2, 1; -2, 1]; b = [-5; -5.00001];
X = A\b
determinate = det(A)
A = [1, 5, -1, 6; 2, -1, 1, -2; -1, 4, -1, 3; 3, -7, -2, 1];
b = [19; 7; 20; -75];
X = A\b
X_1 = A^(-1)*b
Warning: Matrix is singular to working precision.
X =
-Inf
-Inf
determinate =
0
X =
2.0000
10.0000
3.0000
-5.0000
X_1 =
2.0000
10.0000
3.0000
-5.0000
Problem 9
R_1 = 1000; R_2 = 5000; R_3 = 2000; R_4 = 10000; R_5 = 5000; v = 100;
A = [0 , -R_2, 0 , -R_4, 0 , 0 ; ...
R_1, -R_2, R_3 , 0 , 0 , 0 ; ...
0 , 0 , -R_3, -R_4, R_5, 0 ; ...
1 , 1 , 0 , 0 , 0 , -1; ...
0 , 1 , 1 , -1 , 0 , 0 ; ...
-1 , 0 , 1 , 0 , 1 , 0 ];
b = [-v; 0; 0; 0; 0; 0];
i_1_through_i_6_in_Amps = A\b
i_1_through_i_6_in_Amps =
0.0189
0.0049
0.0027
0.0076
0.0162
0.0238
Chapter 7
Problem 1 - Absolute frequency histogram
Mileage = sort([23, 25, 26, 25, 27, 25, 24, 22, 23, 25, 26, 26, 24, ...
24, 22, 25, 26, 24, 24, 24, 27, 23]);
x = [22:27];
Mileage_length = length(Mileage);
hist(Mileage, x), ylabel('Absolute Frequency'), ...
xlabel('Mileage (miles per gallon)'), grid, ...
title('Absolute Frequency Histogram for 22 Milaeges')
Problem 1 - Relative frequency histogram
y = [2, 3, 6, 5, 4, 2]./Mileage_length;
x = [22:27];
bar(x, y), ylabel('Relative Frequency'), ...
xlabel('Mileage (miles per gallon)'), grid, ...
title('Relative Frequency Histogram for 22 Mileages')
Problem 2 - Bin width of 50
Breaking_force = sort([243, 236, 389, 628, 143, 417, 205, ...
404, 464, 605, 137, 123, 372, 439, ...
497, 500, 535, 577, 441, 231, 675, ...
132, 196, 217, 660, 569, 865, 725, ...
457, 347]);
bin_width_50 = [100:50:900];
hist(Breaking_force, bin_width_50), ylabel('Absolute Frequency'), ...
xlabel('Breaking Force (lb)'), grid, ...
title('Absolute Frequency Histogram for 30 Breaking Forces for Bin Widths of 50')
Problem 2 - Bin width of 100
bin_width_100 = [100:100:900];
hist(Breaking_force, bin_width_100), ylabel('Absolute Frequency'), ...
xlabel('Breaking Force (lb)'), grid, ...
title('Absolute Frequency Histogram for 30 Breaking Forces for Bin Widths of 100')
Problem 2 - Bin width of 200
bin_width_200 = [100:200:900];
hist(Breaking_force, bin_width_200), ylabel('Absolute Frequency'), ...
xlabel('Breaking Force (lb)'), grid, ...
title('Absolute Frequency Histogram for 30 Breaking Forces for Bin Widths of 200')
Problem 2 - Better bin width
better_bin_width = [100:150:900];
hist(Breaking_force, better_bin_width), ylabel('Absolute Frequency'), ...
xlabel('Breaking Force (lb)'), grid, ...
title('Absolute Frequency Histogram for 30 Breaking Forces for Bin Widths of 250')
Problem 5
Mileage_abs = [2, 3, 6, 5, 4, 2];
binwidth = 1;
area = binwidth*sum(Mileage_abs);
Mileage_scaled = Mileage_abs/area;
bins = [22:binwidth:27];
bar(bins, Mileage_scaled), ylabel('Scaled Frequency'), ...
xlabel('Mileage (miles per gallon)'), grid, ...
title('Scaled Frequency Histogram for 22 Mileages')
Mean = mean(Mileage)
Standard_deviation = std(Mileage)
Upper_bound = Mean + Standard_deviation
Lower_bound = Mean - Standard_deviation
Mean =
24.5455
Standard_deviation =
1.4385
Upper_bound =
25.9839
Lower_bound =
23.1070