Lab7 - Engineering 7: Introduction to Programming for...

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

View Full Document Right Arrow Icon
Engineering 7: Prof. Alexandre Bayen Introduction to Programming for Engineers Spring 2011 Lab 7: Least Squares Regression Date Assigned: 5:00pm, Friday – Mar 25. Date Due: 5:00pm, Friday – April 1. Problem 1: Do Problem 12.8 in the Reader. Clarifications : You may assume that b is a column vector and that the number of elements in b is the same as the number of rows in A . The output x should be a column vector. You may assume that in the case of an infinite number of solutions, the A matrix has more columns than rows, i.e. A is fat. In the case that there are an infinite number of solutions, you should solve the system using x = pinv(A)*b . >> A = reshape(1:15, 3, 5); >> b = [-5; -4; -3]; >> [N, x] = myNumSols(A,b) N = Inf x = 1.0000 0.6000 0.2000 -0.2000 -0.6000 >> b = [-1.5; 2; 7]; >> [N, x] = myNumSols(A,b) N = 0 x = [] >> A = 3*eye(5); >>b = [1; 2; 3; 4; 5]; >> [N, x] = myNumSols(A,b) N = 1 x = 0.3333 0.6667 1.0000 1.3333 1.6667
Background image of page 1

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

View Full DocumentRight Arrow Icon
Engineering 7: Prof. Alexandre Bayen Introduction to Programming for Engineers Spring 2011 Problem 2: Consider the following network consisting of two power supply stations denoted by S1 and S2 and five power recipient nodes denoted by N1 to N5. The nodes are connected by power lines which are denoted by arrows, and power can flow between nodes along these lines in both directions. Let d i be a positive scalar denoting the power demands for node i, and assume that this demand must be met exactly. The capacity of the power supply stations is denoted by S. Power supply stations must run at their capacity. For each arrow, let f j be the power flow along that arrow. Negative flow implies that power is running in the opposite direction of the arrow. Write a function with header
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 09/07/2011 for the course ENGIN 7 taught by Professor Horowitz during the Spring '08 term at University of California, Berkeley.

Page1 / 6

Lab7 - Engineering 7: Introduction to Programming for...

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

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