Work Text Signals
Work Text Signals
1. Command Window: The Command Window is MATLAB’s main window and opens when
MATLAB is started.
1
2. Figure Window: The Figure Window opens automatically when graphics commands are executed,
and contains graphs created by these commands.
3. Editor Window: The Editor Window is used for writing and editing programs. This window is
opened from the File menu. It is used for writing script files and function files.
2
4. Help Window: The Help Window contains help information. This window can be opened from the
Help menu in the toolbar of any MATLAB window. The Help Window is interactive and can be used
to obtain information on any feature of MATLAB.
3
Working in the command window
The Command Window is MATLAB’s main window and can be used for executing commands, opening
other windows, running programs written by the user, and managing the software.
• To type a command the cursor must be placed next to the command prompt ( >> ).
• Once a command is typed and the Enter key is pressed, the command is executed. However, only the last
command is executed. Everything executed previously (that might be still displayed) is unchanged.
• Several commands can be typed in the same line. This is done by typing a comma between the commands.
When the Enter key is pressed the commands are executed in order from left to right.
• It is not possible to go back to a previous line that is displayed in the Command Window, make a
correction, and then re-execute the command.
• A previously typed command can be recalled to the command prompt with the up-arrow key ( ). When the
command is displayed at the command prompt, it can be modified if needed and then executed. The down-
arrow key ( ) can be used to move down the list of previously typed commands.
• If a command is too long to fit in one line, it can be continued to the next line by typing three periods …
(called an ellipsis) and pressing the Enter key. The continuation of the command is then typed in the new
line. The command can continue line after line up to a total of 4,096 characters.
The semicolon ( ; ):
When a command is typed in the Command Window and the Enter key is pressed, the command is executed.
Any output that the command generates is displayed in the Command Window. If a semicolon ( ; ) is typed at
the end of a command the output of the command is not displayed. Typing a semicolon is useful when the
result is obvious or known, or when the output is very large.
If several commands are typed in the same line, the output from any of the commands will not be displayed
if a semicolon is typed between the commands instead of a comma.
4
Typing %:
When the symbol % (percent) is typed at the beginning of a line, the line is designated as a comment. This
means that when the Enter key is pressed the line is not executed. The % character followed by text
(comment) can also be typed after a command (in the same line). This has no effect on the execution of the
command.
Usually there is no need for comments in the Command Window. Comments, however, are frequently used
in a program to add descriptions or to explain the programs.
The clc command (type clc and press Enter) clears the Command Window. After working in the Command
Window for a while, the display may become very long. Once the clc command is executed a clear window
is displayed. The command does not change anything that was done before. For example, if some variables
were defined previously (see Section 1.6), they still exist and can be used.
The up-arrow key can also be used to recall commands that were typed before.
5
Table 1-3: Trigonometric Functions
A variable is a name made of a letter or a combination of several letters (and digits) that is assigned a
numerical value. Once a variable is assigned a numerical value, it can be used in mathematical expressions,
in functions, and in any MAT-LAB statements and commands. A variable is actually a name of a memory
location. When a new variable is defined, MATLAB allocates an appropriate memory space where the
variable’s assignment is stored. When the variable is used the stored data is used. If the variable is assigned
a new value the content of the memory location is replaced.
6
The Assignment Operator
In MATLAB the = sign is called the assignment operator. The assignment opera-tor assigns a value to a
variable
The left-hand side of the assignment operator can include only one variable name. The right-hand side can be
a number, or a computable expression that can include numbers and/or variables that were previously
assigned numerical values. When the Enter key is pressed the numerical value of the right-hand side is
assigned to the variable, and MATLAB displays the variable and its assigned value in the next two lines.
• MATLAB is case sensitive: it distinguishes between uppercase and lowercase letters. For example, AA,
Aa, aA, and aa are the names of four different variables.
• No spaces are allowed between characters (use the underscore where a space is desired).
• Avoid using the name of a built-in function for a variable (i.e., avoid using cos , sin , exp , sqrt, etc.). Once
a function name is used to define a variable, the function cannot be used.
There are 20 words, called keywords that are reserved by MATLAB for various purposes and cannot be used
as variable names. These words are:
break case catch classdef continue else elseif end for function global if otherwise parfor
When typed, these words appear in blue. An error message is displayed if the user tries to use a keyword as a
variable name. (The keywords can be displayed by typing the command iskeyword.)
7
A number of frequently used variables are already defined when MATLAB is started. Some of the predefined
variables are:
ans A variable that has the value of the last expression that was not assigned to a specific variable. If the
user does not assign the value of an expression to a variable, MATLAB automatically stores the
result in ans .
pi The number π.
eps The smallest difference between two numbers. Equal to 2^(–52), which is approximately 2.2204e–
016.
inf Used for infinity.
i Defined as , which is: 0 + 1.0000i.
j Same as i.
NaN Stands for Not-a-Number. Used when MATLAB cannot determine a valid numeric value. Example:
0/0.
The predefined variables can be redefined to have any other value. The variables pi, eps , and inf , are
usually not redefined since they are frequently used in many applications. Other predefined variables, such
as i and j , are sometime redefined (commonly in association with loops) when complex numbers are not
involved in the application.
SCRIPT FILES
A script file is a list of MATLAB commands, called a program that is saved in a file. When the script file is
executed (run), MATLAB executes the commands.
In MATLAB script files are created and edited in the Editor/Debugger Window. This window is
opened from the Command Window. In the File menu, select New , and then select Script . An open
Editor/Debugger Window
8
Figure 1-6: Editor/Debugger Window
Once the window is open, the commands of the script file are typed line by line. MATLAB
automatically numbers a new line every time the Enter key is pressed. The commands can also be typed in
any text editor or word processor program and then copied and pasted in the Editor/Debugger Window. An
example of a short program typed in the Editor/Debugger Window is shown in Figure 1-7. The first few lines
in a script file are typically comments (which are not executed since the first character in the line is %) that
describe the program written in the script file.
Before a script file can be executed it has to be saved. This is done by choosing Save As... from the File
menu, selecting a location and entering a name for the file. When save d, MATLAB adds the extension .m to
the name. The rules for naming a script file follow the rules of naming a variable (must begin with a letter,
can include digits and underscore, no spaces , and up to 63 characters long). The names of user-defined
variables, predefined variables, and MATLAB commands or functions should not be used as names of script
files.
Running (Executing) a Script File
A script file can be executed either directly from the Editor Window by clicking on the Run icon (see
Figure 1-7) or by typing the file name in the Command Window and then pressing the Enter key. For a file
9
to be executed, MATLAB needs to know where the file is saved. The file will be executed if the folder
where the file is saved is the current folder of MATLA B or if the folder is listed in the search path, as
explained next.
Current Folder
The current folder is shown in the “Current Folder” field in the desktop toolbar of the Command Window, as
shown in Figure 1- 8. If an attempt is made to execute a script file by clicking on the Run icon (in the
Editor Window) when the current folder is not the folder where the script file is saved, then the prompt
shown in Figure 1-8
Figure 1-9 will open. The user can then change the current folder to the folder where the script file is saved,
or add it to the search path. Once two or more different current folders are used in a session, it is possible to
switch from one to another in the Current Folder field in the Command Window. The current folder can also
be changed in the Current Folder Window, shown in Figure 1-10, which
can be opened from the Desktop menu. The Current Folder can be changed by choosing the drive and folder
where the file is saved.
10
An alternative simple way to change the current folder is to use the cd command in the Command
Window. To change the current folder to a different drive, type cd, space, and then the name of the directory
followed by a colon : and press the Enter key. For example, to change the current folder to drive F (e.g., the
flashdrive) type cd F:. If the script file is saved in a folder within a drive, the path to that folder has to be
specified. This is done by typing the path as a string in the cd command. For example, cd('F:\Chapter 1') sets
the path to the folder Chapter 1 in drive F. The following example shows how the current folder is changed
to be drive E. Then the script file from Figure 1-7, which was saved in drive E as ProgramExample.m, is
executed by typing the name of the file and pressing the Enter key.
Verify that the identity is correct by calculating each side of the equation, substituting x = π/5
11
Solution
The problem is solved by typing the following commands in the Command Window.
12
Sample Problem 1-4: Compounded interest
13
Operations with Matrices and Arrays
14
15
16
17
Example: Consider the following sum of functions
Approach 1
Approach 2
Approach 3
18
19
SCRIPTS AND FUNCTIONS IN SIGNAL PROCESSING
20
21
When executed:
22
23
The fprintf Command
24
25
26
USER DEFINED FUNCTIONS
27
28
The following are examples of function definition lines with different combinations of input
and output arguments.
29
30
THE TWO-DIMENSIONAL PLOTS
31
Example of executing a plot Command
32
33
Example: Plot the given data
34
The Figure Window with a plot of the sales data
35
PLOTTING MULTIPLE GRAPHS IN THE SAME PLOT
36
EXAMPLE OF PLOTTING MULTIPLE GRAPHS IN THE SAME PLOT
To plot several graphs using the hold on and hold off commands, one graph is plotted first with
the plot command. Then the hold on command is typed. This keeps the figure window with the
first plot open, including its axis properties and formatting any was done. Additional graphs can
be added with plot command that are typed next. Each plot commands creates a graph that is
added to that figure. The hold off command stops this process. It returns MATLAB to the default
mode in which the plot command erases the previous plot and resets the axis properties: The
following is an example of MATLAB command using hold on and hold off
37
PUTTING MULTIPLE PLOTS ON THE S AME PAGE (THE subplot COMMAND)
38
39
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 1
III. Procedures: (use the space provided to write your MATLAB commands)
Solve the following problems by writing commands in the Command Window, or by writing a program
in a script file and then executing the file.
40
11. Circuit Applications
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing 41
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 2
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Create a 2x3 matrix A with elements 5, -3, 8 on the first row and 9, 2, 10 on the second row
>> A = [5 -3 8; 9 2 10]
2. Create a 2x3 matrix B with elements 10, 7, 4 on the first row and -11, 15, 1 on the second
row
>> A – B
>> C=A + B
42
5. Number 8 is subtracted from C. Save your work
>> C – 8
>> A = [1 4 2; 5 7 3; 9 1 6; 4 2 8];
>> B = [6 1; 2 5; 7 3];
>> C = A*B
8. Do also >>D = B*A. What happens? Why? Place your answer on the answersheet.
10. Create matrices AV = [2 5 1] and BV = [2; 1; 4] and try multiplications AV*BV and
BV*AV. Copy the answer in the worksheet. Why do they differ?
>> A = [2 1 4; 4 1 8; 2 -1 3]
>> B = inv(A)
12. Multiply A*B. What type of matrix is the result? (place your answer in the answersheet)
13. Try also >> A*A^-1. What type of matrix is the result? (place your answer in the
answersheet)
14. Manually get the determinant of A in item 11. Place your calculation in the worksheet.
43
15. ARRAY DIVISION: MATLAB has two types of array division which are the right division
and left division. First is the left division(\) which is used to solve matrix equation AX = B.
In this equation X and B are column vectors. This equation can be used by multiplying on
the left both sides the inverse of A.
A-1AX = A-1B
X = A-1B
X = A\B
For the right division(/); to solve matrix equation XC = D. In this equation X and D are row
vectors. This equation can be used by multiplying on the right both sides the inverse of C.
X.CC-1 = DC-1
X = DC-1
X = D/C
4x – 2y + 6z = 8
2x + 8y + 2z = 4
6x + 10y +3z = 0
16. For element-by-element operation, either multiplication(.*), division (.\ , ./) and
exponentiation (.^) is entered in MATLAB by typing a period in front of the arithmetic
operator. Notice the answers of the following in the given matrices A = [2 6 3; 5 8 4; 4 3 1]
and B = [6 -2 1; 4 -2 6; 5 4 -4]
a. >>A .* B
b. >>A * B
c. >> C = A ./ B
d. >> D = A / B
44
e. >> E = A .^ -1
f. >> F = A ^ -1
g. >> G = A .^ B
h. >> H = A ^ B
17. The electrical circuit shown consists of resistors and voltage sources. Determine the current
in each resistor using the mesh current method which is based on Kirchhoff’s voltage law.
Loop 1 on the loop with 20V , loop 3 on the loop with 12V and loop 4 on the loop with 40V
for uniformity.(Write your MATLAB commands in the answersheet.)
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
ACTIVITY 2 (Aswersheet)
3. Item 13.
_______________________________________________________________________________
4. Item 14.
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 3
46
Name: ______________________ Date Performed: ____________
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Create a script file that calculate the distance of a projectile given its initial velocity and the
angle at which it was shot. Use the output commands to display a mix of text and numbers.
2. Voltage Divider
47
48
3. Create a MATLAB script for the conversion of oF to oC and vice versa.
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 4
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Create a function file that calculate the distance of a projectile given its initial velocity and the
angle at which it was shot. Use the output commands to display a mix of text and numbers.
2. Create a user defined function in solving for the base current, collector current, emitter
current, base voltage, collector voltage and emitter voltage of an NPN transistor connected
in a voltage divider bias.
50
3. Create a user-defined function MATLAB file for the conversion of oF to oC and vice versa.
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 5
1. Use the plot command, understand its format and will be able to implement using line properties such as
its style, color, its marker type.
2. Use the fplot command and implement in two-dimensional plot.
3. Plot multiple graph in the same plot.
4. Format a plot using label, title, text, legend, axis and grid commands.
5. Plot with special graphics such as the bar plot, stairs plot, pie plot histograms and polar plots.
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Create the plot of sine and cosine functions in a single from o to 2π. Apply marker characteristics to
distinguish from each other. Apply title, x and y label, grid and legend. Use hold on/hold off command.
Write your command in here.
51
2. Do problem number 1 using subplots
3. Create the plot of sine and cosine functions in a single from –π to π. Apply marker characteristics to
distinguish from each other. Apply title, x and y label, grid, legend, axis visibility, axis aspect ratio and
axis limits. Use hold on/hold off command. Write your command in here.
52
4. Plot the function y = 3x3 – 26x + 10, its first and second derivative from the limit -2 to 4. Apply marker
characteristics to distinguish from each other. Apply title, x and y label, grid, legend, axis visibility, axis
aspect ratio and axis limits. Use hold on/hold off command. Write your command in here.
5. Plots with special graphics. The following program shows a bar graph of sales(in Million) from 1988 to
1994 of a certain company. The “ r” indicates red bar.
Year = [1988:1994]
Sales= [8 12 20 22 18 24 27]
Bar(Year, Sales, ‘r’)
xlabel (‘Year’)
ylabel (‘Sales (in Millions)’)
a. Do the problem using horizontal bar and apply title. Command: barh(x,y)
b. Do the problem using stairs plot and apply title. Command: stairs(x,y)
c. Do the problem using stem plot and apply title. Command: stem(x,y)
d. Do the problem using pie chart and apply title. Command: pie(x)
e. Do the problem using histogram and apply title. Command: hist(y)
53
6. A stone is thrown with an initial velocity of 50 m/s at an angle of 30 degrees with the horizontal. Make a
script and plot the y position, its velocity in same plot. Plot also in subplots.
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
CHAPTER II
DISCRETE-TIME SIGNALS AND SYSTEMS
DISCRETE-TIME SIGNALS
54
TYPES OF SEQUENCES
55
56
OPERATIONS ON SEQUENCES
57
58
59
DISCRETE-TIME SINUSOIDS
60
SOME USEFUL RESULTS
61
Odd – even decomposition of the above example
62
DISCRETE SYSTEMS
LINEAR SYSTEMS
EXAMPLE
Solutions
63
EXAMPLE
Solutions
64
65
CONVOLUTION
DIFFERENCE EQUATIONS
66
EXAMPLE
Solutions
67
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 7
III. Procedures: (use the pace provided to write your MATLAB commands)
a. x(n)=2δ (n +2) − δ (n − 4) , −5 ≤ n ≤ 5
10
b. x(n) = ∑ (m+ 1)[δ (n−2m)−6(n−2 m−l)], 0 ≤ n ≤ 25.
m=0
68
2. Let x(n) = {1, -2,4,6, -5,8,10}. Generate and plot the samples (use the stem function) of the
following.sequences.
a. x1 (n) = 3x(n + 2) + x(n - 4) - 2x(n)
69
5
e. x5 (n) = ∑ nx (n−k )
k=1
4. Decompose the sequences in problem 2 parts (a), (b), (c), (d),( e) into their even and odd components. Plot
these components using the stem function.
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing 70
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 8
I. Title: CONVOLUTION
II. Objectives:
At the end of this activity, students will be able to
III. Procedures: (use the pace provided to write your MATLAB commands)
1. The linear convolution has several properties:
71
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 9
III. Procedures: (use the pace provided to write your MATLAB commands)
1. A particular linear and time-invariant system is described by the difference equation
Which computes a backward first-order difference of the input sequence. Implement this
differentiator on the following sequences and plot the results. Comment on the appropriateness of
this simple differentiator.
a. x ( n )=5[ u ( n )−u ( n−20 ) ] : a rectangular pulse
b. x ( n )=n [ u ( n )−u ( n−10 ) ] +(20−n)[u ( n−10 )−u ( n−20 ) ] : a triangular pulse
πn
25
c. : a sinusoidal pulse
(¿)[u ( n )−u ( n−100 ) ]
x ( n )=sin ¿
72
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
CHAPTER III
DISCRETE – TIME FOURIER ANALYSIS
73
EXAMPLE
Determine the discrete-time Fourier Transform of x(n) = (0.5)n u(n) at 501
equispaced points between (0, π) and plot its magnitude, angle, real and imaginary
parts.
74
THE PROPETIES OF THE DTFT
75
76
THE FREQUENCY DOMAIN REPRESENTATION OF LTI SYSTEM
77
Example
78
FREQUENCY RESPONSE FUNCTION FROM DIFFERENCE EQUATIONS
Example
79
80
CHAPTER IV
81
82
83
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 10
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Numerically compute the discrete-time Fourier transform of
π
j
0.9 e 3 ) n , 0 ≤ n ≤ 10
x ( n )=¿
Evaluate an plot it at 401 equispaced frequencies over two periods between -2π to 2π. Observe its
periodicity.
84
3. Determine the discrete-time Fourier transform and investigate the conjugate symmetry of its DTFT of
0.9
) n , -10 ≤ n ≤ 10
x ( n )=¿
Evaluate an plot it at 401 equispaced frequencies over two periods between -2π to 2π. Observe its
periodicity
85
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 11
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Verify the linearity property of discrete-time Fourier transform using a real valued finite-duration
sequence x1(n) and x2(n) both are random sequences uniformly distributed between [0,1] over 0 ≤ n ≤ 10
2. Verify the shift property of discrete-time Fourier transform using a real valued finite-duration sequence
x(n) a random sequence uniformly distributed between [0,1] over 0 ≤ n ≤ 10 and y(n) = x(n-2)
86
3. Verify graphically the shift property of the discrete-time Fourier transform using a real valued finite-
duration sequence
π
(¿n/2) , 0 ≤ n ≤ 100
x ( n )=cos ¿
jπn
4
y ( n )=e x (n)
Plot the magnitude and angle of x(n) and y(n) in four separate subplots. Label the plots. Frequencies are
equispaced at 200.
4. Verify the conjugation property Ƒ [ x*(n)] = X*(e-jω) using a complex valued random sequence x(n) with
real and imaginary parts uniformly distributed between [0,1] over -5 ≤ n ≤ 10 at 200 equispaced
frequencies.
x(n) = sin(πn/2) , -5 ≤ n ≤ 10
compute the odd and even parts of x(n) and evaluate their discrete-time Fourier transform using
numerical and verify using graphical method. Frequencies are equipaced at 200. Plot the real part of x,
imaginary part of x, transform of the even part of x, and odd part of x in subplots.
87
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 12
III. Procedures: (use the pace provided to write your MATLAB commands)
n−1
¿ + x (¿ n)
y ( n )=0.5 y ¿
a. Determine H( e jω)
b. Calculate and the plot through MATLAB the steady-state response yss (n) to
n
0.08 π ¿ u(n)
x ( n )=cos ¿
88
n
n−3
¿+1.76 y (¿ n−1)
¿+0.0543 x (¿ n−1)+0.0543 x ( n−2 ) +0.0181 x ¿
y ( n ) =0.0181 x ¿
−1.1829 y ( n−2 )+ 0.2781 y (n−3)
Plot the magnitude and the phase response of this filter and verify that this is a lowpass filter through
MATLAB.
jω
3. For each of the following systems determine H( e ) and plot its magnitude and phase using MATLAB
4
1
a. y ( n )= ∑ x (n−m)
5 m=0
89
d. y ( n )=x ( n )−1.7678 x ( n−1 ) +1.5625 x ( n−2 ) +1.1314 y ( n−1 ) −0.64 y (n−2)
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 13
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Let xa(t) = e-1000 |t| . Determine and plot its Fourier transform.
Sample xa(t) at Fs = 5000 sam/sec to obtain x1(n). Determine and plot X1(ejω)
Sample xa(t) at Fs = 1000 sam/sec to obtain x2(n). Determine and plot X1(ejω)
90
2. An analog signal xa(t) = sin (1000πt) is sampled using the following sampling intervals. In each case, plot
the spectrum of the resulting discrete-time signal
a. Ts = 0.1 ms
b. Ts = 1 ms
c. Ts = 0.01 ms
3. From the samples x1(n) in item 1a, reconstruct xa(t) and comment on the result. Plot the reconstructed
signal using ZOH and FOH interpolations. Comment on the plots.
4. From the samples x2(n) in item 1b, reconstruct xa(t) and comment on the result. Plot the reconstructed
signal using ZOH and FOH interpolations. Comment on the plots.
5. Consider an analog signal xa(t) = cos(20πt), 0 ≤ t ≤ 1. It is sampled at Ts = 0.01, 0.05 and 0.1 sec intervals
to obtain x(n)
a. For each Ts plot x(n)
b. Reconstruct the analog signal ya(t) from the samples x(n) using the sinc interpolation (use ∆t = 0.001)
and determine the frequency in ya (t) from your plot. (Ignore the end effect)
c. Reconstruct the analog signal ya(t) from the samples x(n) using the cubic spline interpolation (use ∆t
= 0.001) and determine the frequency in ya (t) from your plot. (Again, ignore the end effect)
d. Comment on your result.
91
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
CHAPTER V
THE Z-TRANSFORM
92
Some common z- transform pairs
Example
93
Solutions
MATLAB Verification:
94
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 14
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Determine the z-transform of the following sequences. Indicate the region of convergence for each
sequence and verify the z-transform expression using MATLAB
95
a. x(n) = {3, 2, 1, -2, -3}
2. Determiner the z-transform of the following sequences using the z-transform table and the z-
transform properties. Express X(z) as a rational function in z-1. Verify your result using MATLAB.
Indicate the region of convergence in each case and provide a pole-zero plot.
0.9 ¿n u(n−2)
c. πn
x ( n )=n sin ( )
3
u ( n ) +¿
2 n−2
¿ u ( n−1 )
d. 3
x ( n )=n2 ¿
n−3
¿
¿
e. 1 n−2 π
¿ sin { ( n−1 ) }u ( n )
4 2
x ( n ) =¿
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
Pamantasan ng Cabuyao
Banay-banay, Cabuyao, Laguna
ACTIVITY 15
III. Procedures: (use the pace provided to write your MATLAB commands)
1. Determine the results of the following polynomial operations using MATLAB
c. X3(z) = ( 1 + z -1+ z -2 )3
2. Solve the following difference equation for y(n) using one-sided z-transform approach
Generate the first 20 of samples of y(n) using MATLAB, compare them with your answer.
“We are all playing in the game called Life. If you want to be MVP in your own event, let God be your coach”
- Engr. Andaya
Prepared by: Engr. Florante M. Andaya Signals, Spectra and Signal Processing
CHAPTER VI
IMPLEMENTATION OF DISCRETE-TIME FILTERS
97
98
99
100