Midterm 2 07' Solutions, no questions provided

Midterm 2 07' Solutions, no questions provided - Part 1...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Part 1 % ========================= % PART A % A = [1 2 3; 4 1 6]; New A = [-99 2 -99; -99 1 -99]; A(1, 1) = -99; A(1, end) = -99; A(end, 1) = -99; A(end, end) = -99; % ========================= % PART B % Employees = [1 50000; 2 47000; 3 33000; 4 72000; 5 100000]; % Output = [3 33000; 2 47000; 1 50000; 4 72000; 5 100000] [sortedSal, ndx] = sort(Employees(:, 2)); sortedID = Employees(ndx, 1); RankedSalary = [sortedID sortedSal]; % ========================= % PART C % SimEqu = [2.8534; 3.3298; 0.3560] A = [2 5 -1; 10 -12 4; 3 0 -10]; B = [22; -10; 5]; SimEqu = A\B; % Or, equivalently, % C = [A B]; % SimEqu = rref(C); % ========================= % PART D % C = [1 2 3 4; 5 6 7 8; 9 10 11 12]; % Output = [1 2 3 4; 5 10 30 120; 9 90 2700 324000]; [rows, cols] = size(C); D = C; for r = 2:rows for c = 2:cols D(r, c) = D(r, c-1) * D(r-1, c); % Or (not equivalently, but still ok): % D(r, c) = C(r, c-1) * C(r-1, c); end end % ========================= % PART E % Output: -20525 sum = 0; for n = 1:2:100 sum = sum + n*log(1/n^2); % Recall: log() is natural log...
View Full Document

This homework help was uploaded on 03/30/2008 for the course CSE 131 taught by Professor Sticklen during the Spring '08 term at Michigan State University.

Page1 / 3

Midterm 2 07' Solutions, no questions provided - Part 1...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online