14-440-127 Lecture 7 Presentation

14-440-127 Lecture 7 Presentation - 14:440:127 Introduction...

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 14:440:127 Introduction to Computers for Engineers Lecture 7 Lecturer: Blase E. Ur Recitation Instructor: Tianming Li Recitation Instructor: Ke Xu Recitation Instructor: Brian Viezbicke Recitation Instructor: Mingliang Wang PLEASE TAKE LECTURE 7 NOTES AS YOU ENTER THE ROOM Rutgers University SOE 14:440:127 Lecture 7 Reminders / Updates Exam 1- Grades hopefully this week. Project 1- Grades this week. PSET 1- Grades posted. CHANGES Problem Set 2 will be released tomorrow DUE Monday, 10/27 Project 2 will be released 10/24 DUE Sunday, 11/9 Exam 2 will be given 11/5 11/11 Rutgers University SOE 14:440:127 Lecture 7 Built-In Functions To call built-in functions, you type: sin(0.32) OR rem(15,2) The inputs are called arguments. Some functions require more than one. Rutgers University SOE 14:440:127 Lecture 7 User-Defined Functions FIRST LINE: function OUTPUT = NAME(INPUT) Replace NAME with the functions name Replace INPUT with one or more variable names. When the function is called, the arguments are assigned to these variables Replace OUTPUT with the name(s) of some variables. When the function is done executing, the values stored in this (these) variables will be returned. To return multiple variables, put them in a vector. Save the file as NAME.m (or whatever the name of the function is) Now, you can type NAME(5) in the workspace to call this function. Rutgers University SOE 14:440:127 Lecture 7 Example: Doubler Write a function that doubles the input value: function y = doubler(x) y = 2*x; output input Needs value name Save this as doubler.m Now, in the workspace, you can type doubler(22) Be sure to put the semicolon on y=2*x;. Why? Be sure to put the semicolon on y=2*x;....
View Full Document

This note was uploaded on 02/29/2012 for the course 440 127 taught by Professor Blase during the Fall '09 term at Rutgers.

Page1 / 22

14-440-127 Lecture 7 Presentation - 14:440:127 Introduction...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online