Quiz_2007_fall - EE 3054 Signals Systems and Transforms MATLAB Quiz Fall 2007 No laptop no notes no documentation Some MATLAB commands on this quiz may

Quiz_2007_fall - EE 3054 Signals Systems and Transforms...

This preview shows page 1 - 3 out of 6 pages.

EE 3054: Signals, Systems, and Transforms MATLAB Quiz — Fall 2007 No laptop, no notes, no documentation. Some MATLAB commands on this quiz may produce errors. For those cases, please state that. 1. Given the following arrays, x = [3 1 2]; y = [4 2 7]; A = [5 2 1; 8 0 2]; determine the result of each of the following commands. If the command will not correctly execute, state why it will not. >> x(2,1) >> y’ >> A([2 1], [1 2]) >> x + y >> x + A >> x + y’ >> A - [x; y] >> A > 3 >> A(:) >> x + min(y) >> x * y >> x .* y >> B = A; B(1:2,2) = [-5; -10]; B >> C = A; C(1,:) = x; C >> x * A >> x * A’ 1
Image of page 1
2. What are the results of the following commands? x = [3 10 -23 -9 5 30]; k = find(x < 5); x(k) = 0; k x 3. The following code fragment produces 3 graphs. Sketch each of the three graphs. >> n = 0:2:6; >> x = [2 0 1 1]; >> y = [1 3 2 1]; >> z = conv(x,y); >> stem(x) >> stem(n,y) >> stem(z) 4. Write a MATLAB function called mysum to evaluate the following summation N X n =1 ( - 1) n +1 n 2 + 1 The function has one input and one output. The input is the upper limit of summation (i.e. N ). The output is the sum of N values. For example, >> y = mysum(3) y = 0.4000 because 1 2 - 1 5 + 1 10 = 2 5 .
Image of page 2
Image of page 3

You've reached the end of your free preview.

Want to read all 6 pages?

  • Spring '08
  • staff
  • matlab, Summation, Input/output, code fragment

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture