Upload
others
View
4
Download
0
Embed Size (px)
Citation preview
Introduction to MatlabIntroduction to Matlab
Akiko Sekikawa
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
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 )
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
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)
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-
Installation 2Installation 2Chose if you install using Internety g
Installation 3Installation 3Software License Agreementg
Installation 4Installation 4Log In to Your MathWorks Accountg
Installation 5Installation 5Select the License You Want to Install
Installation 6Installation 6Choose the installation typeyp
Installation 7Installation 7Specify the Installation Folderp y
Installation 8Installation 8Specify Products to Install (Custom Only)p y ( y)
Installation 9Installation 9Complete the Installationp
Getting startedGetting started…
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)
File OperationsFile OperationsWorks in the similar way as Unix systemy y
change directorycdcd
list segments List the folder contents- List the folder contents
ls
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')
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 )
HistogramHistogramFunction: hist
n = hist(Y) bins the elements in vector Y into 10 equally spaced containers.
Histogramti- options
n = hist(Y, nbins)( , )where nbins is a scalar, uses nbins number of bins.Hist(Y, 100) gives;
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;
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 )
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.
Scatterplotti- options
Instead of using index, you can have one more vector g , ywith same length to set it as value of another axis.
Scatterplotti- options
Format of data points can also be changedp gplot(X1,Y1,…Xn, Yn, LineSpec)
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