Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

BJT Transistor Modeling, Cheat Sheet of Mathematical logic

BJT Transistor ModelingBJT Transistor ModelingBJT Transistor ModelingBJT Transistor ModelingBJT Transistor ModelingBJT Transistor Modeling

Typology: Cheat Sheet

2020/2021

Uploaded on 07/06/2022

1-sa7
1-sa7 🇹🇷

1 document

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
EE 303 SIGNAL & SYSTEMS
LAB 4: CONVOLUTION
Objective: The objective of this experiment is to learn how to convolve two signals using
Matlab.
Preliminary Work: Please review material about convolution from textbook or your
notes.
Part I: Signals Perspective
For two discrete-time signals x[n] and h[n] that are both o f finite length, you can
implement the convolution operation y[n] = x[n] * h[n] in Matlab using the command
conv. The resulting Matlab array that holds the values of y[n] will have a length equal to
the length o f x[n] plus the length of h[n] minu s o ne.
Here is an example pro ble m: suppose that
x[ n] = δ[ n] - [ n - 1] + 3δ[n - 2] - 4δ[ n - 3] + 2δ[n - 5] + δ[n - 6]
an d
h[ n] = [n] + 2 δ [n - 1] + δ[ n - 2 ] - 2 δ[n - 3] + δ[ n - 4 ] - 4 δ[n - 6] + [n - 8] .
The problem is to use Matlab to co mpute the convolutions y1[n] = x[n] * h[n] and
y2[n] = x[n — 3] * h[n].
Here is t he solut ion for the example problem:
The signal x[n] "goes" from n = 0 t o n = 6, so the shifted signal x[n — 3] "goes" from
n = 0 t o n = 9. This means that we need a Matlab array with 10 elements to hold the
values of x[n — 3] (for n = 0,1,..., 9). To mak e the plott ing easy, we will store both
x[n] and x[n — 3] in 10-element Matlab arrays.
Since h[n] "goes" fro m n = 0 to n = 8, we w ill need a nine-element Matlab array to
hold the values of h[n]. Each convolution result will have a length of 10 + 9 - 1 = 18,
corresponding to the "times" n = 0 , 1, . . ., 17 .
Her e is sa mple Mat lab code t o co mput e the two convolutio ns and plot them both in
the same figur e using the subp lot command:
x = [1 -2 3 -4 0 2 1 0 0 0]; % Input signal zero-padded to length 10
xm3 = [0 0 0 1 -2 3 -4 0 2 1]; % Shifted input signal x[n-3]
h = [3 2 1 -2 1 0 -4 0 3]; % Impulse response
y1 = conv(x,h); % Make y1[n] = x[n] * h[n]
y2 = conv(xm3,h); % Make y2[n] = x[n-3] * h[n]
n = 0:17; % "time" values for x-axis of plot
pf2

Partial preview of the text

Download BJT Transistor Modeling and more Cheat Sheet Mathematical logic in PDF only on Docsity!

EE 303 SIGNAL & SYSTEMS

LAB 4: CONVOLUTION

Objective: The objective of this experiment is to learn how to convolve two signals using Matlab. Preliminary Work : Please review material about convolution from textbook or your notes. Part I: Signals Perspective For two discrete-time signals x[n] and h[n] that are both of finite length, you can implement the convolution operation y[n] = x[n] * h[n] in Matlab using the command conv. The resulting Matlab array that holds the values of y[n] will have a length equal to the length of x[n] plus the length of h[n] minus one. Here is an example problem: suppose that x[n] = δ[n] - 2δ[n - 1] + 3δ[n - 2] - 4δ[n - 3] + 2δ[n - 5] + δ[n - 6] and h[n] = 3δ[n] + 2δ[n - 1] + δ[n - 2] - 2δ[n - 3] + δ[n - 4] - 4δ[n - 6] + 3δ[n - 8]. The problem is to use Matlab to compute the convolutions y1[n] = x[n] * h[n] and y2[n] = x[n — 3] * h[n]. Here is the solution for the example problem: The signal x[n] "goes" from n = 0 to n = 6, so the shifted signal x[n — 3] "goes" from n = 0 to n = 9. This means that we need a Matlab array with 10 elements to hold the values of x[n — 3] (for n = 0,1,..., 9). To make the plotting easy, we will store both x[n] and x[n — 3] in 10-element Matlab arrays. Since h[n] "goes" from n = 0 to n = 8, we will need a nine-element Matlab array to hold the values of h[n]. Each convolution result will have a length of 10 + 9 - 1 = 18, corresponding to the "times" n = 0 , 1 ,... , 1 7. Here is sample Matlab code to compute the two convolutions and plot them both in the same figure using the subplot command: x = [1 - 2 3 - 4 0 2 1 0 0 0]; % Input signal zero-padded to length 10 xm3 = [0 0 0 1 - 2 3 - 4 0 2 1]; % Shifted input signal x[n-3] h = [3 2 1 - 2 1 0 - 4 0 3]; % Impulse response y1 = conv(x,h); % Make y1[n] = x[n] * h[n] y2 = conv(xm3,h); % Make y2[n] = x[n-3] * h[n] n = 0:17; % "time" values for x-axis of plot

subplot(2,1,1); % Make a 2x1 array of graphs and make % the first graph the "current" one stem(n,y1); % Plot y1 against n title('y_1[n] = x[n] * h[n]'); % Title for top graph xlabel('n'); % X-axis label for top graph ylabel('y_1[n]'); % Y-axis label for top graph subplot(2,1,2); % Select the second graph as "current" stem(n,y2); % Plot y2 against n title('y_2[n] = x[n-3] * h[n]'); % Title for bottom graph xlabel('n'); % X-axis label for bottom graph ylabel('y_2[n]'); % Y-axis label for bottom graph Now it's your turn. Let x[n] = δ[n] + 3δ[n - 2] + δ[n - 3] + 2δ[n - 4] - δ[n - 5] and h[n] = 2δ[n] + 2δ[n - 2]. (a) Write Matlab code to compute and plot the following convolutions: y1[n] = x[n] *h[n] and y2[n] = x[n — 2] * h[n].

  • Plot each convolution result.
  • Use the subplot command to plot both y1[n] and y2[n] in a single figure.
  • For each result, use the stem command to do the plotting.
  • Label each plot with the time index n and the name of the result signal. (b) Based on the plots from part (a), would you guess that the system is time invariant or time-varying?