{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

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(16 : -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 π/ 2 to π/ 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 = 1 6 5 4 2 9 8 0 7 has been defined, i.e. >>A = [1 6 5; 4 2 9; 8 0 7]; . 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.

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.

{[ snackBarMessage ]}

What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern