113_1_ee113 matlab tutorial

# 113_1_ee113 matlab tutorial - EE 113 Digital Signal...

This preview shows pages 1–10. Sign up to view the full content.

EE 113: Digital Signal Processing Matlab Tutorial Teaching Assistants: Nick Mastronarde, Yu Zhang, Shaolei Ren Spring 2010

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

View Full Document
Where to use Matlab • Computer labs http://www.seasnet.ucla.edu/classes/seasnet-computer-labs • Obtain Matlab License – UCLA Store: Matlab Student Edition (\$99) – Signal Processing Toolbox (\$59)
Matlab GUI 2

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

View Full Document
Command window Enter and execute commands line-by-line Function help/documentation: help or doc 3
Matlab scripts: m-fles Adding a semicolon at the end of a line will cause Matlab to suppress any output in the command window. 4

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

View Full Document
Working with m-fles Comments begin with % , cells begin with %% Evaluate current cell: Ctrl + Enter Evaluate current cell and advance: Ctrl Shift + Enter Run entire script: F5 Evaluate selection: F9 5
Basic operators Add, subtract, multiply, divide: a+b, a-b, a*b, a/b Power: 2^3 ans = 8 Elementwise operator: a.*b, a./b, a.^b Greater than, less than, equal, not equal: a>b, a<b, a==b, a~=b Functions Many built-in functions: sin(x), cos(y), sqrt(z), atan(u), .... Make your own functions using m-Fles: function y = myFunc(x) Toolboxes (e.g. signal processing toolbox) 6

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

View Full Document
Essential commands/functions Resetting environment Remove all variables from workspace: clear Close current/all open Fgure windows: close , close all Clear command window: clc Creating variables Scalar: a = 1.2 Row vector: r = [1,2,3] (commas can be omitted) Column vector: c = [1;2;3] Matrix: A = [1 2; 3 4] creates a matrix A = b 1 2 3 4 B 7
Essential commands/functions (cont.) Creating variables Vector u = (1 , 2 , . . . , 6) : u = 1:6 Vector v = (1 , 1 . 1 , . . . , 1 . 9 , 2 . 0) : v = 1:0.1:2 Column vector of ones: e = ones(7,1) Matrix of zeros:

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

## This note was uploaded on 06/01/2010 for the course EE EE113 taught by Professor Mihaela during the Spring '10 term at UCLA.

### Page1 / 23

113_1_ee113 matlab tutorial - EE 113 Digital Signal...

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

View Full Document
Ask a homework question - tutors are online