{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

113_1_Matlab tutorial (week 1)

113_1_Matlab tutorial (week 1) - Matlab GUI EE 113 Digital...

Info icon This preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon
EE 113 – Digital Signal Processing MATLAB Tutorial Teaching Assistants: Martin S. Andersen & Hyunggon Park Spring Quarter 2008 – Week 1 Where to use Matlab Computer Labs SEASnet Labs http://www.seas.ucla.edu/seasnet/ EElab in 53-125 E-IV ? Obtain a Matlab license UCLA Store: Matlab Student Edition ($99) Signal Processing Toolbox ($59) 1 Matlab GUI 2 Command window Enter and execute commands line-by-line Function help/documentation: help or doc 3
Image of page 1

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

View Full Document Right Arrow Icon
Matlab scripts: m-files Adding a semicolon at the end of a line will cause Matlab to suppress any output in the command window. 4 Working with m-files 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 Operators & functions 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-files: function y = myFunc(x) Toolboxes (e.g. signal processing toolbox) 6 Essential commands/functions Resetting environment Remove all variables from workspace: clear Close current/all open figure 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 = bracketleftbigg 1 2 3 4 bracketrightbigg 7
Image of page 2
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
Image of page 3

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

View Full Document Right Arrow Icon
Image of page 4
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern