2 EE 3054 Signals Systems and Transforms MATLAB Quiz Fall 2006 No laptop no

2 ee 3054 signals systems and transforms matlab quiz

This preview shows page 5 - 10 out of 11 pages.

2
Image of page 5
EE 3054: Signals, Systems, and Transforms MATLAB Quiz — Fall 2006 No laptop, no notes, no documentation. 1. Given the following array a , a = 3 7 6 9 4 10 1 8 3 2 5 11 determine the result of each of the following commands. >> a(4, 3) >> a(3, 4) >> a(0, 2) >> a(5) >> a’ >> a([2 3], [1 2]) >> a([2 1], [2 3]) >> a(4:-1:1, 3:-1:1) >> a([2 2], :) >> a(end, 2) >> max(a) >> a(:) >> b = a; b([1 3],[1 3]) = [-1 -2; -3 -4]; b >> b = a; b(:,2) = []; b >> a > 5 1
Image of page 6
2. Given the following vector a , a = 4 2 3 7 6 determine the result of each of the following commands. >> a(1,3) >> a(3,1) >> find(a > 5) >> a * a >> a .* a >> [a, a] >> [a; a] >> [M, k] = min(a); M, k 3. Write a MATLAB code fragment to generate the spiral figure illustrated below, including axis labels, and title. The formula for the spiral using polar coordinates is x = θ cos( θ ) y = θ sin( θ ) The figure illustrates the spiral for 0 θ 4 π . -10 -5 0 5 10 -10 -8 -6 -4 -2 0 2 4 6 x y SPIRAL 2
Image of page 7
4. The following code fragment produces 3 graphs. Sketch each of the three graphs. >> n = 0:2:8; >> x = [2 3 1 0 1]; >> plot(n,x) >> plot(x) >> stem(n,x) >> stem(x) 5. What is the result of the following commands? >> b = [1 2 3]; >> conv(a,b) 6. Write a MATLAB function called runave that has one output and one input. (That means, write the contents of the file runave.m .) The input is a vector; the output is also a vector. You can assume the input vector is of even length. The output vector should be the average of each pair of input vector values. The length of the output vector should half the length of the input vector. >> runave([5 1 3 6 9 10 1 3]) ans = 3.0000 4.5000 9.5000 2.0000 because the average of 5 and 1 is 3, the average of 3 and 6 is 4.5, the average of 9 and 10 is 9.5, the average of 1 and 3 is 2. Your program should not use a for or while loop and it should not use an if statement. 3
Image of page 8
EE 3054: Signals, Systems, and Transforms Lab Quiz 1 — Spring 2006 No laptop, no notes, no documentation.
Image of page 9
Image of page 10

You've reached the end of your free preview.

Want to read all 11 pages?

  • Spring '08
  • staff
  • matlab, following commands, Time index

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture