This is in Matlab language 1-Read \'kilowatt.txt\' one number at a time and buil
ID: 2080581 • Letter: T
Question
This is in Matlab language 1-Read 'kilowatt.txt' one number at a time and build a 4x3 matrix of kilowatt values using (row,col) indexing in nested for loops. Get the row and column indexes for the overall minimum and maximum kilowatt values. 2-Convert the kilowatt values to btu/h, hp, and ft lbf/s. Create one matrix with each of the above unit measurement 4x3 matrices as a column: kw, btu/h, hp, and ft lbf/s. Sort the combine matrix by the kilowatt column. 3-Print the original matrix of all unit measurements with a title and column headers. See output below Print the overall minimum and maximum values in each unit matrix using the same row and column index found in #1 above for the kilowatt matrix. See output below. Print the overall minimum and maximum values, again, using the first and last rows of the sorted matrix. See output below. You do not know the number of rows. 1 kW = 3412.14 Btu/h = 737.56 ft lbf/s 1 hp = 550 ft lbf/s = 2544.5 Btu/h
Explanation / Answer
%GECP calculate Gauss elimination with complete pivoting % % (G)aussian (E)limination (C)omplete (P)ivoting % Input : A nxn matrix % Output % L = Lower triangular matrix with ones as diagonals % U = Upper triangular matrix % P and Q permutations matrices so that P*A*Q = L*U % % See also LU % % written by : Cheilakos Nick [n, n] = size(A); p = 1:n; q = 1:n; for k = 1:n-1 [maxc, rowindices] = max( abs(A(k:n, k:n)) ); [maxm, colindex] = max(maxc); row = rowindices(colindex)+k-1; col = colindex+k-1; A( [k, row], : ) = A( [row, k], : ); A( :, [k, col] ) = A( :, [col, k] ); p( [k, row] ) = p( [row, k] ); q( [k, col] ) = q( [col, k] ); if A(k,k) == 0 break end A(k+1:n,k) = A(k+1:n,k)/A(k,k); i = k+1:n; A(i,i) = A(i,i) - A(i,k) * A(k,i); end L = tril(A,-1) + eye(n); U = triu(A); P = eye(n); P = P(p,:); Q = eye(n); Q = Q(:,q);
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.