Lecture2 - Lecture 2: Programming Basics in MATLAB Cinna...

Info iconThis preview shows pages 1–5. 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
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Lecture 2: Programming Basics in MATLAB Cinna (see-na) Wu [email protected] Modified from slides by Ryan Hynd Department of Mathematics University of California, Berkeley Math 98 : Introduction to MATLAB programming Announcements Announcements HW 1 Due next Thursday in class : http://math.berkeley.edu/ ~ cinnawu/math98HW1.pdf Office Hours : Monday 11-12 or by appointment (in 1095 Evans). Creating M-files We will write programs via M-Files The editor (or edit window) is where all MATLAB programs are written. A file saved in the editor is a MATLAB M-file . M-files can be run or executed in the command window. Writing programs is good as opposed to doing everything in the command window because it is a way of documenting code (MATLAB statements) that is now portable and easy to modify. Example: x 7 x 3 function Y= cube(X) Y = X 3; Basic program format Structure of any program Input Body of Algorithm Output Typical structure of a MATLAB program function Output=nameOfProgram(Input) Body of Algorithm Output=...; Example: Approximate...
View Full Document

This note was uploaded on 01/21/2012 for the course MATH 98 taught by Professor Instuctor during the Spring '08 term at University of California, Berkeley.

Page1 / 12

Lecture2 - Lecture 2: Programming Basics in MATLAB Cinna...

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

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