introduction tointroduction to matlabmicrosoft powerpoint - intro_matlab.pptx author amoses created...

34
Introduction to Matlab Introduction to Matlab Akiko Sekikawa

Upload: others

Post on 26-Jul-2020

3 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Introduction to MatlabIntroduction to Matlab

Akiko Sekikawa

Page 2: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

MATrix LABoratoryMATrix LABoratoryA numerical computing environment that allows;p g ;

matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces

Where to buy?http://www.mathworks.com/Download software packageDownload software packageOr order DVD

Page 3: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

ContentsContents� System requirement and installation� System requirement and installation

� How to load a tab-delimited file (readtext, dlmread)

� How to make a histogram (hist)

� How to make a scatterplot (plot)p (p )

Page 4: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

System Requirement- release 2010b operating systems

Windows Mac Linux

Wi d XP S i P k 3 M OS X 10 5 8 (L d) S t dWindows XP Service Pack 3

Windows XP x64 Edition Service Pack 2

Mac OS X 10.5.8 (Leopard) and above

Mac OS X 10.6.x (Snow

Supported distributions

Ubuntu 9.10 and

Windows Server 2003 R2 Service Pack 2

(Leopard) 10.04 LTS

Red Hat Enterprise Linux 5 x and 6 x

Windows Vista Service Pack 1 or 2

Linux 5.x and 6.x

SUSE Linux Enterprise

Windows Server 2008 Service Pack 2 or R2

Windows 7

pDesktop 11.x

Debian 5.xWindows 7

Page 5: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

System Requirement- release 2010b

Processors Disk Space RAMAny Intel or AMD x86 processor supporting

1 GB for MATLAB only,3–4 GB for a

1024 MB(At least 2048 MB

SSE2 instruction set(Windows&Linux)

typical installation recommended)

All Intel-based Macs with an Intel Core 2 or later(Mac)

Page 6: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 1Installation 1

After Insertion of the DVD into the DVD drive or downloading the product files from the MathWorks website;

Windows Systems —The installer should start automatically. y y

Linux Systems — For DVD, execute the following command:/path_to_dvd/install &For downloaded files, extract the installer from the archive file and execute the installer command:./install

Macintosh Systems —When the DVD icon appears on the desktop, double-

Page 7: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 2Installation 2Chose if you install using Internety g

Page 8: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 3Installation 3Software License Agreementg

Page 9: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 4Installation 4Log In to Your MathWorks Accountg

Page 10: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 5Installation 5Select the License You Want to Install

Page 11: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 6Installation 6Choose the installation typeyp

Page 12: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 7Installation 7Specify the Installation Folderp y

Page 13: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 8Installation 8Specify Products to Install (Custom Only)p y ( y)

Page 14: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Installation 9Installation 9Complete the Installationp

Page 15: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Getting startedGetting started…

Page 16: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

ContentsContentsSystem requirement and installationy q

� How to load a tab-delimited file (readtext, dlmread)dlmread)

� How to make a histogram (hist)

� How to make a scatterplot (plot)

Page 17: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

File OperationsFile OperationsWorks in the similar way as Unix systemy y

change directorycdcd

list segments List the folder contents- List the folder contents

ls

Page 18: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM
Page 19: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

How to load atab delimited filestab-delimited files

textread or dlmreadFile with tab-delimited numbers will be read as vectorX = textread(’filename') or X= dlmread(’filename')

Page 20: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM
Page 21: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

ContentsContentsSystem requirement and installationy q

How to load a tab-delimited file (readtext, dlmread)

� How to make a histogram (hist)

� How to make a scatterplot (plot)p (p )

Page 22: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

HistogramHistogramFunction: hist

n = hist(Y) bins the elements in vector Y into 10 equally spaced containers.

Page 23: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM
Page 24: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Histogramti- options

n = hist(Y, nbins)( , )where nbins is a scalar, uses nbins number of bins.Hist(Y, 100) gives;

Page 25: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Histogramti- options

n = hist(Y,x) where x is vector( , )returns the distribution of Y among length(x) bins with centers specified by x.hi t( b) h b 10 0 1 10 ( t f 10 10 1 9 9hist(a, b) where b = -10:0.1:10 (vector of -10, -10.1,…,9.9, 10) gives;

Page 26: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

ContentsContentsSystem requirement and installationy q

How to load a tab-delimited file (readtext, dlmread)

How to make a histogram (hist)

� How to make a scatterplot (plot)p (p )

Page 27: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

ScatterplotScatterplotFunction: plot (default gives simple line chart)p ( g p )

plot(Y) plots the columns of Y versus the index of each value when Y is a real number.

Page 28: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM
Page 29: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Scatterplotti- options

Instead of using index, you can have one more vector g , ywith same length to set it as value of another axis.

Page 30: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM
Page 31: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

Scatterplotti- options

Format of data points can also be changedp gplot(X1,Y1,…Xn, Yn, LineSpec)

Page 32: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM
Page 33: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM

SummarySummarySystem requirement and installationy q

How to load a tab-delimited file (readtext, dlmread)

How to make a histogram (hist)

How to make a scatterplot (plot)

If you are stuck with usage of functionsIf you are stuck with usage of functions…help function name

Page 34: Introduction toIntroduction to MatlabMicrosoft PowerPoint - Intro_matlab.pptx Author Amoses Created Date 2/3/2011 10:18:49 AM