recitation 1

recitation 1 - EE103 Spring 2009 Recitation 1 Yue Zhao...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
EE103 Spring 2009 Recitation 1 Yue Zhao Examples to type (line by line, without the comments) in the command window: A = [1 2 3; 4 5 6; 7 8 9] A = [1 2 3; 4 5 6; 7 8 9]; % with semicolon 1:5 % a default step size of 1 1:0.5:5 % 0.5 is the step size A(1:3, 2) A(:,2) % : is equivalent to 1:3 here A(1,:) B = A' b = [1;2;3 4;5;6 7;8;9] b = [[1;2;3] [4;5;6] [7;8;9]] b = [[1;2;3],[4;5;6],[7;8;9]] % comma and space have the same effect here x = 1:5 y = 2:0.5:4 x * y x * y' x.*y % element-wise multiply 2^x 2.^x % element-wise power x(2) == y(1) % return a Boolean scalar x == y % return a Boolean vector min(x == y) % return a Boolean scalar, comparing the whole vector max(x) [x,6] max([x,6]) % compare all elements in x and 6, choose the largest one max(x,6) % compare every element in x with 6, choose the larger one, return % a vector max(x,3) pi format long pi format short pi M-files: create a new m-file. Type in the following program: % my first program x = [0: 0.1: 2*pi]; y = sin(x); figure(1)
Background image of page 1

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

View Full DocumentRight Arrow Icon
Image of page 2
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 EE 103 taught by Professor Jacobsen during the Spring '09 term at UCLA.

Page1 / 2

recitation 1 - EE103 Spring 2009 Recitation 1 Yue Zhao...

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

View Full Document Right Arrow Icon
Ask a homework question - tutors are online