matlab overview Jan 14

matlab overview Jan 14 - MATLAB Overview I 1. 2. 3. 4....

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

View Full Document Right Arrow Icon
MATLAB Overview I 1. Vector Operation 2. Matrix Operation 3. Array Construction 4. Array Addressing MATLAB Æ MAT rix LAB oratory MATLAB Overview II 1. M-Files 2. Flow-Control (for loops, while loops, if- else-end) 3. 2-D Plotting 4. Debugging 5. Practice problems Demonstrations on MATLAB Two Types of M-Files ± Files containing code with MATLAB commands or statements – M-File < NOTE > M-Files MUST be saved with the extension ' . m ' Two types of M-Files: ± Script M-File ± Function M-File Script M-Files ± Execute script files by calling the filename in command window ± All variables generated by script files are stored in workspace % script file example 1 script1.m clear a = [1 2; 3 4]; % create matrix a b = ones(2,2); % create matrix b y = a.*b % find element by element product of a and b
Background image of page 1

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

View Full DocumentRight Arrow Icon
Function M-Files ± Begins with a function definition line , which includes a well defined list of inputs and outputs. % the first line of code function [output variables] = function_name (input variables); 1. First word ‘function’ must be typed in lower case ± Without this line, the file becomes a script M-file . Function M-Files function [y] = myfun(x) % myfun.m : a very simple example of function m-file. a = 2; b = 3;
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 04/12/2009 for the course BME 210 taught by Professor D'argenio during the Spring '07 term at USC.

Page1 / 5

matlab overview Jan 14 - MATLAB Overview I 1. 2. 3. 4....

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

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