14-440-127 Recitation 6 Presentation

# 14-440-127 Recitation 6 Presentation - 14:440:127...

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

14:440:127 Introduction to Computers for Engineers Recitation 6 Lecturer: Blase E. Ur Recitation Instructor: Tianming Li Recitation Instructor: Ke Xu Recitation Instructor: Brian Viezbicke Recitation Instructor: Mingliang Wang

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

View Full Document
Rutgers University SOE 14:440:127 Recitation 6 For Loop for VARIABLE = VECTOR STATEMENTS end i.e. for i = 1 : 100 disp(i) end First time through the loop, i=1 Then, go back to the top; i=2 The last time through the loop, i=100
Rutgers University SOE 14:440:127 Recitation 6 Sum 1 to 100 with a for loop s = 0; z s for z = 1:100 0 pre-loop s = s+z; 1 1 after the first time end 2 3 second time disp(s) 3 6 third time 4 10 fourth 5 15 fifth 6 21 sixth …. 100 5050 hundredth

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

View Full Document
Rutgers University SOE 14:440:127 Recitation 6 Find the max (and location) in a vector maxvalue = -inf; location = -1; for x = 1:length(V) if(V(x)>maxvalue) maxvalue = V(x); location = x; end end disp(maxvalue) disp(location)
Rutgers University SOE 14:440:127 Recitation 6 Find all locations of max in a vector

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 ]}

### Page1 / 12

14-440-127 Recitation 6 Presentation - 14:440:127...

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

View Full Document
Ask a homework question - tutors are online