{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Lecture+06+Presentation

# Lecture+06+Presentation - 14:440:127 Introduction to...

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

14:440:127 Introduction to Computers for Engineers Lecture 6 Lecturer: Brenda Cortez Recitation Instructors: Yun, Bo, Karthik, Muhammad 1

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

View Full Document
Rutgers School of Engineering LEC06 14:440:127 General Announcements HW02 - DUE THIS WEDNESDAY - expected output = what you must have PROJ02 - WILL BE ASSIGNED ON FRIDAY EXAM01 - GRADES OUT BY WEDNESDAY - exams @ my office to view only Office Location changed to BME120 - no office hours on Tuesdays apps.rutgers.edu - try it out again and answer bi-weekly polls on Sakai Attending the University of Illinois ACM (Association for Computing Machinery) Reflections|Projections Conference 2010 Conference Videos @ http://www.acm.uiuc.edu/conference/2010/ Learn more about ACM @ http://www.acm.org/ Will not be in office on Friday, October 15 2
Rutgers School of Engineering LEC06 14:440:127 Last week ʼ s topics: Plotting 2D, 3D, Meshgrid, Log plots Graphical Input Interpolation Regression Fitting Equation to Data 3 Lets do some examples...take notes!

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

View Full Document
Rutgers School of Engineering LEC06 14:440:127 Using a polynomial to model a function can be very useful, but it is always dangerous to extrapolate beyond your data. We can demonstrate this pitfall by modeling a sin wave as a third order polynomial. a)Define x from -1 to 1 in increments of 0.1 b)Calculate y as being the sin of the elements in x c)Use the polyfit function to determine the coefficients of a third order polynomial to model the set of data. d)Use the polyval function to calculate new values of y (modeled_y), based on your polynomial, for your x vector from -1 to 1 e)Plot both sets of values on the same graph. How good is the fit? f)Create a new_x vector from -4 to 4 in increments of 0.1 g)Create a new_y values by finding sin(new_x) h)Extrapolate new_modeled_y values by using polyfit, the coefficients vector you found in part(c) to model x and y between -1 and 1, and the new_y values i)Plot both new sets of values on the same graph. How good is the fit outside of the region from -1 to 1? 4
Rutgers School of Engineering LEC06 14:440:127 Loops FOR and WHILE loops Iterative – Over and Over again Each pass through a loop is called an iteration 5

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

View Full Document
Rutgers School of Engineering LEC06 14:440:127 Prior to For Loops DISPLAY HELLO 15 TIMES THE OLD FASHION WAY disp('HELLO') disp('HELLO') disp('HELLO') disp('HELLO') disp('HELLO') ... disp('HELLO') 6 sooooooo repetitive! solve it with a loop!
Rutgers School of Engineering LEC06 14:440:127 For Loops for VARIABLE_NAME = VECTOR_OF_VALUES STATEMENTS .... end 7 Note: It says VECTOR ! vector of values 1->15 variable name is x Example: for x = 1:15 disp('HELLO') end

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

View Full Document
Rutgers School of Engineering LEC06 14:440:127 Prior to For Loops In the old fashion way , for 1 through 15, print: The number is… fprintf('The number is %.0f\n',1) fprintf('The number is %.0f\n',2) fprintf('The number is %.0f\n',3) fprintf('The number is %.0f\n',3) ...
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### Page1 / 43

Lecture+06+Presentation - 14:440:127 Introduction to...

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

View Full Document
Ask a homework question - tutors are online