Midterm 1 Practice Problems

# Midterm 1 Practice Problems - University of California,...

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

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

View Full Document
E77 Midterm I, Fall 2005 NAME: 1 Part What is the output when the following commands are typed in sequence from the MATLAB command window? Do not worry about the exact format of the output. 1. (2) >> clear all >> x = 4*2/4+(-2)ˆ2; >> x = 2. (2) >> y = 4*(2\4)-2ˆ(2); >> y = 3. (2) >> y = floor(3.2)+log(exp(2)); >> y = 4. (2) >> z =5*sin(pi/2)+sqrt(9); >> z = 5. (2) >> who Numbers between parenthesis are the points allocated to each question. page 2/10
E77 Midterm I, Fall 2005 NAME: 2 Part Assume that the following commands have been entered into the MATLAB command window: >> clear all > >a=2 ; >> b = [1;4]; >> c= [1 2]; Write the output that the following commands will produce. Do not worry about the exact format of the output. If the result produces a Matlab error then write ERROR. 1. (2) > >a+b ans = 2. (2) > >a. *c ans = 3. (2) > >a*c ans = 4. (2) > >c. ˆa ans = 5. (2) > >b+c ans = 6. (2) >> b’ + c ans = 7. (2) >> c .ˆ (b’) ans = Numbers between parenthesis are the points allocated to each question. page 3/10 This material has not yet been covered in F'07

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

View Full Document
E77 Midterm I, Fall 2005 NAME: 3 Part 1. What is the output when the following commands are sequentially typed from the MATLAB command window? Do not worry about the exact format of the output. (a) (1) >> s = ’Are you asleep yet?’; >> length(s) = (b) (2) >> s([5 7 14]) = (c) (3) > > s ( 1 6:- 3:9 ) = 2. Fill in the blanks, exactly as you would in Matlab, to create two vectors, V and W , each having 101 elements and ranging from π/ 2to 2. (3) >> V = linspace( ); (3) >> W = [ : : ]; Numbers between parenthesis are the points allocated to each question. page 4/10
E77 Midterm I, Fall 2005 NAME: 4 Part Assume that the matrix A = 165 429 807 has been defned, i.e. >>A = [1 6 5; 4 2 9; 8 0 7]; . Write the output that the ±ollowing commands will produce. Do not worry about the exact ±ormat o± the output. I± the result produces a Matlab error then write ERROR.

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/01/2009 for the course ENGLISH 7 taught by Professor Sengupta during the Spring '09 term at University of California, Berkeley.

### Page1 / 22

Midterm 1 Practice Problems - University of California,...

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

View Full Document
Ask a homework question - tutors are online