quiz01_1

# quiz01_1 - MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department...

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

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Civil and Environmental Engineering 1.017 Computing and Data Analysis for Environmental Applications Quiz 1 (Solutions) Thursday, October 4, 2001 Please answer all questions on a separate piece(s) of paper with your name clearly indentified: Problem 1 (15 points) Suppose a = [ 6 7 -1 9 3] b = [-3 12 7 11 -2] Evaluate the following expressions … i) b>0 ii) a(b>0) iii) find(((a>b)&(b<0))|(a>5)) Problem 2 (15 points) Write the output of the following MATLAB script in the proper order, proceeding downward from the first line of output as it would appear on the command window screen: a=[1 2]; for i=1:3:9 a=2.*a-3; if(a<-4) flag=1; else flag=0; end result=[a, flag] end Problem 3 (15 points) Identify errors in the following MATLAB program and write a revised version with these errors corrected. 1

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

View Full Document
function main a= [0.2 0.5] b=3*ones(2,1) x=subfunc(a.*b) return function subfunc(a) x=sin(2*pi*a); return Problem 4 (25 points) Suppose that you are given a two dimensional array called
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 11/29/2011 for the course CIVIL 1.00 taught by Professor Georgekocur during the Spring '05 term at MIT.

### Page1 / 2

quiz01_1 - MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department...

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

View Full Document
Ask a homework question - tutors are online