Вы находитесь на странице: 1из 40

Signals & Systems

Introduction to MATLAB
Bo-Yuan Peng
E.E. Dept.,
National Taiwan University
Before the talk starts…
 Our course website:
• http://cktlab.ee.ntu.edu.tw/ss2010spring
 Remember to be concerned about any
of the changes on our course website.
The Course Web Site
Outline
 What is MATLAB?
 Where to use MATLAB?

 How to use MATLAB?

 Homework 1
What is MATLAB?
 MATLAB is an interactive environment in w
hich you can write programs to do many p
owerful calculation.
• Number calculation
• Matrix calculation
• Plots and/or sketches of mathematical graphs
• Symbolic calculation
• Differential Equations
• Blablabla…
Where to use MATLAB?
 The MathWorks, Inc. sells MATLAB.
• If you are rich, then you may use it at home.
• If you are poor…?
 Fortunately, this university is rich.
• You can use MATLAB at Computer Center.
 MATLAB is installed in every computer in every comp
uter classroom in CC Building.
 MATLAB is installed in every computer in EEII107.
 Also, you can connect to the Soft-Bank provided by C
omputer Center to access MATLAB remotely, given yo
ur IP is 140.112.x.x .
• http://softbank.cc.ntu.edu.tw/
• Only 6 licenses available. DON’T OCCUPY the resource.
Soft-Bank in CC
Soft-Bank in CC
Soft-Bank in CC
Soft-Bank in CC
How to Access MATLAB at Home?
 Soft-Bank can be accessed only if
your IP is 140.112.x.x .
 Solution: Virtual Private Network

• https://sslvpn.ntu.edu.tw/
• You can log-in with your student
account provided by CC.
Access MATLAB at Home
Access MATLAB at Home
Access MATLAB at Home
How to use MATLAB?
 If you are using MATLAB from Soft-
Bank, just click it on.
 If you are using MATLAB in the

computer classroom in CC, select


Start -> Programs -> MATLAB ->
MATLAB will turn on MATLAB.
How to use MATLAB?
 You will have to know the path wher
e MATLAB is installed. In CC, it is inst
alled in C:\Program Files\MATLAB .
• All of your programs in MATLAB should
be put into C:\Program Files\MATLAB\w
ork in order to use the file.
How to use MATLAB?
 First test
• Simple calculation +, -, *, /, ^, mod()
• Operators
• Use help
 Variables
• No need to declare. Just use it.
• DO NOT use variable i and j. They are
imaginary numbers.
 Matrices
• Use of squared bracket [ ]
• * vs. .*; / vs. ./
How to use MATLAB?
 The use of operator :
 plot(), stem(), subplot()

 Flow Control

• if… elseif… else… end


• switch… case… otherwise… end
• for, while, continue, break
How to use MATLAB?
 m-file: a batch of MATLAB command
• You can edit an m-file and save it in the
work folder
• Use it as a command
How to use MATLAB?
 If you want to plot a lot of graphs…
• subplot()
• figure()
• pause
How to use MATLAB?
 Functions in MATLAB
• You’d better to use one m-file with one f
unction.
• syntax: function y = foo()
 Some useful function
• zeros()
• ones()
Homework 1
 Download the .pdf file and the .zip file with
m-files inside.
 Pick m-files from the .zip file.
 Follow the instructions inside the .pdf file t
o construct one proper m-file.
 Do discussion with the results in a .pdf file.
• You may do discussion in Word 2007 then save
it as a .pdf file.
 Compress the discussion and the m-file int
o one .zip/.rar file.
 Upload the compressed file to the website.

Вам также может понравиться