Lab 5 - Engineering 7: Introduction to Programming for...

Info iconThis preview shows pages 1–2. 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 5: Complexity and Numerical Precision Date Assigned: 5:00pm, Friday – Mar 4. Date Due: 5:00pm, Friday – Mar 11. Problem 1: Do Problem 8.1 in the Reader Test Cases: >> d = myBin2Dec([1 1 1]) d = 7 >> d = myBin2Dec([0 0 0 0 0]) d = 0 >> d = myBin2Dec([1 0 1 0 1 0 1]) d = 85 >> d = myBin2Dec(ones(1,25)) d = 33554431 Problem 2: Do Problem 8.2 in the Reader. Clarification : The output must be a row vector and the leading term must be a 1 unless the decimal input value is 0. Test Cases: >> b = myDec2Bin(0) b = 0 >> b = myDec2Bin(23) b = 1 0 1 1 1 >> b = myDec2Bin(2097) b = 1 0 0 0 0 0 1 1 0 0 0 1 Problem 3: Do Problem 8.4 in the Reader. Clarification : Write a function with header [b] = myBinAdder(b1,b2) where b1 , b2 , and b are binary numbers represented as in Problem 1. The output variable should be computed as b = b1 + b2 . Do not use your functions from Problem 1 and 2 to write this function (i.e., do not convert
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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 Berkeley.

Page1 / 3

Lab 5 - Engineering 7: Introduction to Programming for...

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