Matlab_tutorial

Matlab_tutorial - BCB570 MatlabTutorial...

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

View Full Document Right Arrow Icon
Click to edit Master subtitle style 3/8/10 BCB 570 Matlab Tutorial January 27, 2010 11
Background image of page 1

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

View Full DocumentRight Arrow Icon
3/8/10 Outline Matlab Installation GUI Overview Data types Programming in Matlab Creating plots ODEs and other topics Resources 22
Background image of page 2
3/8/10 Matlab Installation Please go to http://www.it.iastate.edu/matlab/student/ for instructions on how to download and install Matlab 33
Background image of page 3

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

View Full DocumentRight Arrow Icon
3/8/10 GUI Overview Current Folder Command Window >> help func % Display help text for “func” >> whos % Lists current variables >> clear % Clears the workspace >> clear var1 % Clears variable “var1” Workspace Data can be imported via GUI Variables may be opened and edited in the “Variable Editor” (like Excel) 44
Background image of page 4
3/8/10 Data Types (1/5) Variables are, by default, n -dimensional arrays with elements of double precision >> x = 5; % Create an object, x and give it value 5 55 The semicolon suppresses output >> size(x) % Use the size() function to get the size of x ans = % The return value is stored in “ans” by default 1 1 % size() tells us that x is a 1x1 array >> y = [1 2; 3 4] % Create a 2x2 array, y y = 1 2 3 4 >> z = size(y); % Get the size of y and store in a new variable, z >> z % Display z z = 2 2
Background image of page 5

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

View Full DocumentRight Arrow Icon
3/8/10 Data Types (2/5) Accessing array data >> d = [1 3; 2 5; 0 -1; .3 1; 4 0] % Create data array, d d = 1.0000 3.0000 2.0000 5.0000 0 -1.0000 0.3000 1.0000 4.0000 0 66 Indexing for arrays starts at 1 (not 0) The colon selects ALL columns >> d(4,1) % Select the fourth row, first % column of d ans = 0.3000 >> d(1,:) % Select the first row of d ans = 1 3
Background image of page 6
3/8/10 Data Types (3/5) >> d(2:4,:) ans = 2.0000 5.0000 0 -1.0000 0.3000 1.0000 % Select the 2nd through 4th rows of d 77 2:4 gives a range of data to select Use arrays as data matrices along with all operators associated with matrix algebra Multidimensional arrays are acceptable Use 1xn arrays as vectors Can use A.*B for element-by-element multiplication
Background image of page 7

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

View Full DocumentRight Arrow Icon
3/8/10 Data Types (4/5) Define and initialize a structures
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 21

Matlab_tutorial - BCB570 MatlabTutorial...

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

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