EE 350 Continuous-Time Linear Systems Recitation...
Transcript of EE 350 Continuous-Time Linear Systems Recitation...
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
EE 350
Continuous-Time Linear Systems
Recitation 2
1
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Recitation 2 Topics
• MATLAB Programming– Vector Manipulation– Built-in Housekeeping Functions
• Solved Problems– Classification of Signals– Basic Signal Operations
2
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Vector Manipulation• Elements are accessed by specifying an index ranging from
1 to the number of elements in the vector
• Display elements 2 through 3 of vector
• Delete elements 2 through 3
3
>> x = [2, 4, 6, 8];
>> x(2:3)ans =
4 6
>> x = [2, 4, 6, 8];
>> x(2:3) = []ans =
2 8
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Vector Manipulation • Display the last two elements of the vector x
• Display every other element starting with the first element of x
4
>> x = [2, 4, 6, 8];
>> x(end-1 : end)ans =
6 8
>> x = [2, 4, 6, 8];
>> x(1 : 2 : end) ans =
2 6
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Vector Functions in MATLAB
5
Operation Functionlength of vector x; returns the number of elements length(x)
size of vector x; returns the number of rows and columns size(x)transpose of x x’largest element in x max(x)smallest element in x min(x)sum of elements in vector x sum(x)indices of nonzero elements find(x)indices of elements in a specified range find(x>3)first n indices corresponding to the nonzero elements in x find(x, n)Last n indices corresponding to the nonzero elements in x find(x, n, ‘last’)
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 1• For the vector x = -4 : 2 : 10, use MATLAB to determine
1. length(x)2. size(x)3. x’4. size(x’)5. min(x)6. max(x)7. sum(x)8. find(x)9. find(x < 0)10. find(x,3)11. find(x,3,’last’)
6
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Housekeeping Functions
7
Operation Functionlists variables currently in the workspace wholists variables currently in the workspace with their size whosclear all variables from the workspace clearclear command window, cursor moves to the top clcclear the current figure window clfclose the current figure window closeclose all the figure windows close all
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2
• The response of system to a unit-step input is often characterized by the rise-time, which is the time for the output to rise from 10% to 90% of its final value
• Write an m-file that determines the rise-time of
8
( ) 1 0ty t e t
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2• The m-file must
– Clear the workspace and command window, and close open figures
– Generate a time vector t of 1000 points uniformly spaced between 0 and 10
– Generate a vector y whose elements represent the values of the response at the time instants in t
– Numerically determine the rise-time using find
– Plot y versus t, and in the legend, specify the rise-time use the strcat and num2str functions
9
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2
10
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2
11
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3• Consider the signal
1. Sketch f(t)2. Classify f(t) as a causal or noncausal signal3. Is f(t) either an even or odd function?4. Is f(t) periodic or aperiodic?5. Is f(t) an energy signal? If so, determine the energy
metric Ef
6. What is Pf, the power of the signal f(t)?
12
( ) ( )tf t e u t
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3 Solution
13
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3 Solution
14
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3 Solution
15
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4• Consider the signal
1. Sketch f(t)2. Classify f(t) as a causal or noncausal signal3. Is f(t) either an even or odd function?4. Is f(t) periodic or aperiodic? If periodic, what is the
fundamental period?5. Is f(t) an energy signal? If so, determine the energy metric Ef
6. Is f(t) a power signal? If so, determine the power metric Pf
16
( ) 5 ( 10 2) u(t 10 2)n
n
f t u t n n
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4 Solution
17
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4 Solution
18
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4 Solution
19
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5• Express the signal f(t) as the sum of even and odd functions
1. Verify, for an arbitrary f(t), that the functions fe(t) and fo(t) are even and odd functions, respectively
2. Determine expressions for fe(t) and fo(t) for the given f(t)3. Sketch f(t), fe(t) and fo(t)
20
-( ) ( ) ( ) ( )
where
( ) ( ) ( ) ( )( ) and ( )2 2
te o
e o
f t e u t f t f t
f t f t f t f tf t f t
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5 Solution
21
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5 Solution
22
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5 Solution
23
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6• Consider the signal shown below
1. Find an expression for f(t)2. Sketch the following signals: f(t-1), 2f(t+1), f(t/3), f(-t), f(1-t)
24
( )f t
t101
1
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6 Solution
25
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6 Solution
26
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6 Solution
27
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
EE 350
Continuous-Time Linear Systems
Recitation 2
1
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Recitation 2 Topics
• MATLAB Programming– Vector Manipulation– Built-in Housekeeping Functions
• Solved Problems– Classification of Signals– Basic Signal Operations
2
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Vector Manipulation• Elements are accessed by specifying an index ranging from
1 to the number of elements in the vector
• Display elements 2 through 3 of vector
• Delete elements 2 through 3
3
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Vector Manipulation • Display the last two elements of the vector x
• Display every other element starting with the first element of x
4
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Vector Functions in MATLAB
5
Operation Functionlength of vector x; returns the number of elements length(x)
size of vector x; returns the number of rows and columns size(x)transpose of x x’largest element in x max(x)smallest element in x min(x)sum of elements in vector x sum(x)indices of nonzero elements find(x)indices of elements in a specified range find(x>3)first n indices corresponding to the nonzero elements in x find(x, n)Last n indices corresponding to the nonzero elements in x find(x, n, ‘last’)
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 1• For the vector x = -4 : 2 : 10, use MATLAB to determine
1. length(x)2. size(x)3. x’4. size(x’)5. min(x)6. max(x)7. sum(x)8. find(x)9. find(x < 0)10. find(x,3)11. find(x,3,’last’)
6
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Housekeeping Functions
7
Operation Functionlists variables currently in the workspace wholists variables currently in the workspace with their size whosclear all variables from the workspace clearclear command window, cursor moves to the top clcclear the current figure window clfclose the current figure window closeclose all the figure windows close all
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2
• The response of system to a unit-step input is often characterized by the rise-time, which is the time for the output to rise from 10% to 90% of its final value
• Write an m-file that determines the rise-time of
8
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2• The m-file must
– Clear the workspace and command window, and close open figures
– Generate a time vector t of 1000 points uniformly spaced between 0 and 10
– Generate a vector y whose elements represent the values of the response at the time instants in t
– Numerically determine the rise-time using find
– Plot y versus t, and in the legend, specify the rise-time use the strcat and num2str functions
9
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2
10
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 2
11
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3• Consider the signal
1. Sketch f(t)2. Classify f(t) as a causal or noncausal signal3. Is f(t) either an even or odd function?4. Is f(t) periodic or aperiodic?5. Is f(t) an energy signal? If so, determine the energy
metric Ef
6. What is Pf, the power of the signal f(t)?
12
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3 Solution
13
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3 Solution
14
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 3 Solution
15
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4• Consider the signal
1. Sketch f(t)2. Classify f(t) as a causal or noncausal signal3. Is f(t) either an even or odd function?4. Is f(t) periodic or aperiodic? If periodic, what is the
fundamental period?5. Is f(t) an energy signal? If so, determine the energy metric Ef
6. Is f(t) a power signal? If so, determine the power metric Pf
16
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4 Solution
17
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4 Solution
18
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 4 Solution
19
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5• Express the signal f(t) as the sum of even and odd functions
1. Verify, for an arbitrary f(t), that the functions fe(t) and fo(t) are even and odd functions, respectively
2. Determine expressions for fe(t) and fo(t) for the given f(t)3. Sketch f(t), fe(t) and fo(t)
20
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5 Solution
21
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5 Solution
22
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 5 Solution
23
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6• Consider the signal shown below
1. Find an expression for f(t)2. Sketch the following signals: f(t-1), 2f(t+1), f(t/3), f(-t), f(1-t)
24
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6 Solution
25
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6 Solution
26
Recitation 2.School of Electrical Engineering and Computer Science
Jeffrey Schiano 2015-2017 All rights reserved.
Problem 6 Solution
27