This preview shows pages 1–5. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: Lecture 2: Programming Basics in MATLAB Cinna (seena) 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 1112 or by appointment (in 1095 Evans). Creating Mfiles We will write programs via MFiles The editor (or edit window) is where all MATLAB programs are written. A file saved in the editor is a MATLAB Mfile . Mfiles 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.
 Spring '08
 Instuctor
 matlab

Click to edit the document details