lecture15_slides

lecture15_slides - Introduction to Matlab Today: Review of...

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

View Full Document Right Arrow Icon
Introduction to Matlab Today: Review of Matlab environment Variables and expressions Loading/viewing your data Matrices and common matrix tasks Next week: Spring break! Following week Introduction to probability/statistics More matlab: Functions for matrices Loops and conditional statements in Matlab Using built-in statistics functions to analyze data
Background image of page 1

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

View Full DocumentRight Arrow Icon
The Matlab Interface Command interpreter window Current directory Command history Workspace (current variables and values)
Background image of page 2
Writing Matlab programs • Enter statements directly into the command window OR • Create files with sets of commands (scripts) • run script by changing Matlab’s current directory to the directory containing the script, type script name on command line • runs as if you typed the commands at the prompt yourself • must be a .m file (use Matlab’s editor to create the file) • Caution!: scripts stop executing when they encounter an error
Background image of page 3

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

View Full DocumentRight Arrow Icon
Matlab scripts expressions.m Example script: expressions.m Open/edit by going to File->Open Run by changing the current directory to the folder with this script and type expressions in the command window.
Background image of page 4
Matlab variables and expressions Variables Variable names must consist of a letter, followed by any number of letters, digits, or underscores, e.g. this_is_ok num28 $chad 1var Matlab doesn’t require variable declarations just initialize and begin using a variable Expressions: combinations of variables, numbers, strings, operators, and functions ; - suppresses output Perl requires $ before all variables, Matlab won’t allow $ in var. names. Perl requires that each line end with ; Matlab accepts with or without.
Background image of page 5

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

View Full DocumentRight Arrow Icon
Matlab variables and expressions Numbers: Strings: Operators + , - , * , /, ^ (a^b = a b ) (more about logical operators later) Functions Perl allows increment operations like $x++; and $x+=1; but Matlab does not. Instead, use x = x+1; Matlab strings are always in single quotes as compared to Perl’s “. expressions.m
Background image of page 6
Matlab built-in functions >> help elfun Elementary math functions. Trigonometric. sin - Sine. sind - Sine of argument in degrees. sinh - Hyperbolic sine. asin - Inverse sine. asind - Inverse sine, result in degrees. asinh - Inverse hyperbolic sine. cos - Cosine. cosd - Cosine of argument in degrees. cosh - Hyperbolic cosine. acos - Inverse cosine. acosd - Inverse cosine, result in degrees. acosh - Inverse hyperbolic cosine. tan - Tangent. tand - Tangent of argument in degrees. tanh - Hyperbolic tangent. atan - Inverse tangent. atand - Inverse tangent, result in degrees. atan2 - Four quadrant inverse tangent. atanh - Inverse hyperbolic tangent. sec
Background image of page 7

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

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

This note was uploaded on 10/21/2011 for the course CSCI 3003 taught by Professor Staff during the Spring '08 term at Minnesota.

Page1 / 20

lecture15_slides - Introduction to Matlab Today: Review of...

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

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