You are on page 1of 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/ss2009spring

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 which you can write programs to do many powerful 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 computer classroom in CC Building. MATLAB is installed in every computer in EEII107. Also, you can connect to the Soft-Bank provided by Computer Center to access MATLAB remotely, given your IP is 140.112.x.x .
http://softbank.cc.ntu.edu.tw/ Only 6 licenses available. DONT 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 SoftBank, 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 where MATLAB is installed. In CC, it is installed in C:\Program Files\MATLAB .
All of your programs in MATLAB should be put into C:\Program Files\MATLAB\work 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
Youd better to use one m-file with one function. 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 to construct one proper m-file. Do discussion with the results in a .pdf file. Compress the discussion and the m-file into one .zip/.rar file. Upload the compressed file to the website.
You may do discussion in Word 2007 then save it as a .pdf file.

You might also like