14-440-127 Lecture 7 Notes

# 14-440-127 Lecture 7 Notes - 14:440:127 Introduction to...

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

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

View Full Document
Following your first line, just type Matlab code that implements your function (performs any calculations you need). Don’t forget that by the end of the last line of this code, your output variables need to have been set. 1.1.1 Example Function Let’s say you wanted to create a function called doubler , which doubles some number x when you type double(x) . You can type the following code, which you MUST save as doubler.m function y = doubler(x) y = 2*x; Now, once you’ve saved this file as doubler.m , you can type something like doubler(22) in the Matlab workspace or in other m-files, and your function will execute as if it were a built-in function.
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