E7_Su2010_Solutions8_all

E7_Su2010_Solutions8_all - E7 Assignment 8 Solutions Summer...

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

View Full Document Right Arrow Icon
E7 Assignment 8 Solutions Summer 2010 Contents Problem 1 (a) (b) (c) (d) Problem 2 (a) (b) Problem 3 (a) (b) (c) (d) Problem 4 (a) (b) (c) (d) (e) Problem 5 (a) (b) Problem 6 (a) (b) (c) (d) (e) Problem 7 Problem 8 Problem 9 (a) (b) Problem 10 (a) (b) (c) (d)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Problem 1 type leastcases function [exists, unique] = leastcases(A,b) if size(A,1) ~= length(b) error('A and b have incompatible dimensions') end if rank([A b]) == rank(A) exists = true; else exists = false; end if rank(A) == size(A,2) unique = true; else unique = false; end A more concise version is type leastcasesbrief function [exists, unique] = leastcasesbrief(A,b) if size(A,1) ~= length(b) error('A and b have incompatible dimensions') end exists = ( rank([A b]) == rank(A) ); unique = ( rank(A) == size(A,2) ); (a) A = [-5 4; 1 4]; b = [-1; 6]; [exists,unique] = leastcases(A,b) exists = 1 unique = 1 (b) A = [-1 3; -1 3]; b = [4; 2]; [exists,unique] = leastcases(A,b) exists =
Background image of page 2
0 unique = 0 (c) A = [1 3; -2 -6]; b = [-1; 2]; [exists,unique] = leastcases(A,b) exists = 1 unique = 0 (d) A = [-1 0; 1 3; 1 -1]; b = [-1; 1; 5]; [exists,unique] = leastcases(A,b) exists = 0 unique = 1 Problem 2 (a) type kirchoff function currents = kirchoff(voltage,resist) % Kirchoff's voltage law Avolt = [ 0 -resist(2) 0 -resist(4) 0 0; . .. resist(1) -resist(2) resist(3) 0 0 0; . .. 0 0 -resist(3) -resist(4) resist(5) 0 ]; bvolt = [ -voltage; 0; 0 ]; % Conservation of charge Acharge = [ -1 -1 0 0 0 1; . .. 0 1 1 -1 0 0; . .. 1 0 -1 0 -1 0; . .. 0 0 0 1 1 -1 ]; bcharge = zeros(4,1); % Combine equations and compute currents A = [Avolt;Acharge]; b = [bvolt;bcharge]; currents = pinv(A)*b; (b)
Background image of page 3

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

View Full DocumentRight Arrow Icon
V = 100; R = [1 5 2 10 5000]; currents = kirchoff(V,R) currents = 5.2791 3.1599 5.2602 8.4201 0.0189 8.4390 Problem 3 (a) A = [1 0 0 1; -1 1 0 0; 0 1 -1 0; 0 0 1 1]; b = [450; 250; 350; 350]; (b) Using A and b defined above [exists,unique] = leastcases(A,b) x = pinv(A)*b exists = 1 unique = 0 x = 75.0000 325.0000 -25.0000 375.0000 (c) A = [1 0 0 1; -1 1 0 0; 0 1 -1 0;0 0 1 1;0 0 0 1]; b = [450; 250; 350; 350; 0]; [exists,unique] = leastcases(A,b) x = A \ b exists = 1 unique = 1 x = 450.0000 700.0000 350.0000 -0.0000
Background image of page 4
(d) A = [-1 0 0 1;-1 1 0 0;0 1 -1 0;0 0 1 1;0 0 0 1;0 0 1 0]; b = [450; 250; 350; 350; 0; 0]; [exists,unique] = leastcases(A,b) x = A \ b exists = 0 unique = 1 x = -113.3333 246.6667 6.6667 226.6667 Problem 4 For simplicity, just put all the point in one array points = [ -2 2; 1 2.7; -4 -7; 5 1; 2 2 ]; (a) A = [ points(1,1)^4 points(1,1)^3 points(1,1)^2 points(1,1) 1; ... points(2,1)^4 points(2,1)^3 points(2,1)^2 points(2,1) 1; ... points(3,1)^4 points(3,1)^3 points(3,1)^2 points(3,1) 1; ... points(4,1)^4 points(4,1)^3 points(4,1)^2 points(4,1) 1; ... points(5,1)^4 points(5,1)^3 points(5,1)^2 points(5,1) 1 ];
Background image of page 5

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

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

This note was uploaded on 08/14/2010 for the course E 7 taught by Professor Patzek during the Summer '08 term at University of California, Berkeley.

Page1 / 23

E7_Su2010_Solutions8_all - E7 Assignment 8 Solutions Summer...

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

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