Signals Lab Final
Signals Lab Final
2013AAPS049H
Prepared by
Faculty & Research Scholars
Dept. EEE
References:
1. Lab Manual on Signals & Systems
2. Lathi B P, Principles of Signal Processing & Linear Systems Oxford University Press, 2009.
3. Nagrath I J, Sharan S N, Ranjan Rakesh & Kumar S, Signals & Systems, Second Edition TMH,
2001
Revision History
Version
Number
V0.1
V0.2
V0.3
Date
Jan 20,
2015
Jan 31,
2014
Feb
03,2015
Revised With
Added Experiment No. 1A :
Familiarization with MATLAB
Added Experiment No. 1B : Advanced
Matlab Exercises
Experiment 2: First exposure to
signals via Function Generator and
oscilloscope
Prepared by
R.Venkateswaran, Prabhakara Rao, Y.
Yoganandam,
R.Venkateswaran, Prabhakara Rao, Y.
Yoganandam,
R.Venkateswaran, Prabhakara Rao,
Y. Yoganandam,
Contents
Purpose of the Document ............................................................................................................................... 3
Revision History ............................................................................................................................................. 4
Experiment 2: First exposure to signals via Function Generator and oscilloscope ................................... 4
Experiment 1A: Familiarization with MATLAB.......................................................................................... 6
Run # 01: ........................................................................................................................................... 6
Run #02: Graphical Commands ...................................................................................................... 7
Run # 03:Basic Commands for working in MATLAB .................................................................. 9
Run # 04: Vectors and matrices in MATLAB ............................................................................... 11
Experiment 1B: Advanced MATLAB Exercises ........................................................................................ 12
A. Running commands in the command window........................................................................12
B. Code generation, File Creation and editing: ............................................................................14
C. Code Readability and Coding Style..........................................................................................16
ADDITIONAL EXERCISES ........................................................................................................20
Experiment 2: First exposure to signals via Function Generator and Oscilloscope ................................ 21
Function generator ..........................................................................................................................22
Oscilloscope ....................................................................................................................................24
Function generator and Oscilloscope ............................................................................................24
Run # 01:
MatLab (MATrixLABoratory) is matrix based software package for computation engineering.
Science and applied mathematics. It offers a powerful programming language, excellent
graphics, and wide range of expert Knowledge. A numerical analyst called Cleve Moler wrote
the first version of MATLAB in the 1970.
Open the Matlab (Hint : double click on Matlab Icon available on the desktop)
Q1. Make a rough sketch of Matlab windows
Q2. (a) What is command window?
Hint : use the given path
HELP
DOCUMENTATION
SEARCH
Answer:15 , yes
Q3. (a) What is meant by command history?
(b) What is the purpose of command history in MATLAB?
Answer:
a) Command History gives us the record of previous answers and commands entered
by the user .
b) It helps the user check and reuse his earlier commands
Q4. (a) What is Workspace?
(b) Can you save this workspace file?
(c) What is the extension of this workspace file?
Answer:
a) Workspace is the window which consists the variables the user creates and stores in
the memory in matlab session.
b) Yes
c) .mat
Q5. (a) What is current directory that Matlab is working in?
(b) How can you change the path of the current directory?
Answer:
a) Location of the folder where our current work space is saved .
b) Entering new path in directory .
Q6. (a) What is Editor window?
(b) What is the extension of the file that is saved in Editor window?
(c) What is m-file?
(d) Enter edit command in command window and write your comments?
Answer :
a) Editor window is the window for a string of commands aimed at a specific function
(eg . Plotting a graph)
b) .m
c) Editor window that is saved in .m extension
Q7.
clc
clear all
close all
Answer :
a) Clears command window .
b) Removes all variables from memory .
c) Closes everything .
(a)
plot (t, y)
Answer:
fs = 100;
f = 5;
t = 0:1/fs:1;
y = sin(2*pi*f*t);
plot (t,y)
(b)
area (t, y)
g = area(t,y)
answer is g = 174.0093 sq units
.
(c)
plot(t,y);
hold on/hold off
plot(t,y/2)
(d)
xlabel
xlabel(time axis)
x axis is labelled
(e)
ylabel
ylabel(amplitude)
y axis is labelled
(f)
title(`Plot Title')
title(sine wave)
Q9. Write your comments on the following commands and give one example on each
A = [1 2 3]
sum( ) : = 6
returns the sum of all elements in array
mean( ) := 2
mean of all elements in the array
length( ) : = 3
returns the length of a 1 D array
max( ) := 3
value of the largest element in the array
min( ) := 1
value of the least element in the array
prod( ) : = 6
product of all elements in the array
sign( ) := [1 1 1]
sign function , 1 is +ve , -1 if ve , 0 if 0
fix( ) : [1 2 3]
rounds all elements to nearest zero
floor( ):[1 2 3]
greatest integer function
ceil( ) : [1 2 3]
least integer greater than or equal to each element is the input
round( ) :1 2 3
rounds element to nearest integer
abs( ):[1 2 3]
prints modulus of inputs (effective value/magnitude)
Q10. Type in the command window: A=3; B=A*4 ; C = A*B; Validate the values of the
variables in the workspace and note down in the observation book.
Workspace
A=3
B = 12(A*4 = 3*4 =12)
C = 36(A*B = 3*12)
**********************************
(h) KINGmaker
(d) 5dog
(i) Myclass21:42
Answer :
a) valid .meets all criteria .
b) valid
c) valid
d) not valid . name should not start with Int
e) invalid . name should not contain space
f) not valid . name should not contain hyphen
g) valid
h) invalid .name should not contain any symbol other than underscore .
2. What do you expect the value of Z = 3^(3^2) to be when executed in command window
? How does this differ from Y = 3^3^2 ?
Answer:
Z = 3^(3^2) = 19683
Y = 3^3^2 = (3^3)^2 (by convention) = 729
3. Perform the following Vector Operations and write your observations on each operation:
Answer:
b) [2 3; 3 15]\[5;8]
c) [2 3; 3 15]/[5 8]
d) [2 3; 3 15]\[5 8]
(b) gives the correct answer , and the answer is x = 2.4286 . y = 0.0476
6. Analyze and execute the following code and find the value of A and Comment on the
results.
A = [ [1 2 3]' [3 2 1]' [2 1 3]'];
B = A;
for j=2:3
A (j, :) = A (j, :) A (j-1, :)
end
A=
1
1 -1 -1
3
-1 -1
A=
for j=2:3
A (j, :) = A (j, :) B (j-1, :)
end
A=
1
1 -1 -1
3
-1 -1
-1
A=
7. Analyze and execute the following code and display all values of a. write your
observations on the variable a at the end of execution of the code.
k=5;
for m = 1:k
forn = 1:k
if m == n
a(m,n) = 2;
elseif abs(m-n) == 2 ;a(m,n) = 1;else; a(m,n) = 0;end ; end
end
a =
2 0 1 0 0
0 2 0 1 0
1 02 0 1
0 1 0 2 0
0 0 1 0 2
8.
Two statements are given below. Execute statement 1 and statement 2, individually and
comment on their outputs?
Statement 1: X = 5; X >= [1 2 3; 4 5 6; 7 8 10]
ans
1 1
1 1
0 0
=
1
0
0
ans
1 1
1 1
0 0
=
1
0
0
= 0 , otherwise
%
% Functions used :cicon.m, licon.m
% Type of convolution - circular convolution, linear convolution
% Author name of the student (ex. Bhavyasree)
% Ver 0.0
% Initializing variables
% load ('initvar.mat');
% Generating signals
[m,c,u,M,C,U,f] = cicon(t0,ts,fc,t,df,fs);
%Demodulation process
[y,Y,dem,DEM,H] = licon(u,c,ts,df,fs,f);
b. Print the value of N and the time taken for execution by Matlab (when vector operations
are used).
N=10
Time of execution=0.0012 seconds
Note : Learn the Matlab command for printing the values of a variable
c. Input the values for N as vector of values, starting with one and ending with 100000, in
steps of 100. Plot a graph between N & time of execution.
d. For the plots, make sure that the labels of x & y axes represent appropriate scale & units
and give proper titles to the plots.
e. Comment on all your observations
11. Generation of a Step Signal
a. Write the expression for a step with amplitude 7 and occurring at time t= 2.395 sec.
x=0 t<2.395
x=1
b.
t>=2.395
c. Generate the same step signal using Matlab and plot, showing the time and amplitude
scales.
t= -5:0.01:5;
X= zeros(size(T));
cut = 0;
fori= -5:0.01:5
ifi>2.395
X(cut)=7
end
cut=cut+1
end
plot(t,x)
e.
f. Generate the same ramp signal using Matlab and plot, showing the time and amplitude
scales.
t= 0:0.001:15.35;
X= zeros(size(T));
cut = 0;
fori= 0:0.001:15.35
ifi>0.345
X(cut)=X(cut-1) + 0.001533
end
cut =cut+1
end
plot(t,x)
plot(y,x1,color,r;hold on);
plot(y,x2,color,g;hold on);
plot(y,x3,color,y);
i.
ii.
iii.
Plot, all of them on a single plot, showing the time scale and amplitude scale. Indicate the
different plots, using arrows and text appropriately.
ADDITIONAL EXERCISES
1.During high school days, you might have solved: x = y + 1 and 2x = y.
a. What are the values of x and y, that satisfy given equations? ( x = ____, y = ____ )
b. Generate a vector x with values starting at -5 and ending at +5, in steps of 0.01
c. Write a Matlab code to compute y, for the values of x generated above.
d. Solve the above equations graphically by plotting the values of y Vs x. Comment on the
observations on accuracy of the results from (a) and (c). Does change in the step size in
(b) help in getting more accurate solution?
e. For the plots, make sure that the labels of x & y axes represent appropriate scale & units
and Give proper titles to the plots.
2. Generate Sine & Cosine waves for angles between -60 & 60 degrees, in steps of 0.01
degree. Obtain Tan function values using the Sine & Cosine waves, without using for
loop. Plot the Tan values and compare with the built in tan function of Matlab. For the
plots, make sure that the labels of x & y axes represent appropriate scale & units. Give
proper titles to the plots.
3. Exploring the commands rand, randnand hist.
a. Generate 1000 real random numbers between (-25 and +25) using rand function and plot
them.
b. Find the mean and standard deviation of the random numbers generated in (a). Can you
calculate the mean standard deviation theoretically and compare with what you obtain
from Matlab?
c. Repeat (a) and (b) with randn command.
d. Learn the usage of hist command.
4. Plot the distribution of the random numbers generated using rand and randn commands.
For this you may generate 100000 numbers and use 1000 bins for histogram
generation.Consider the function y(n) = [x(n) + x(n-1) + x(n-2) ]/3.
a. Write a Matlab code, using for loop, to generate x(n), for n=1,2,..1000 and to compute
the output y(n). Consider the usage of zero entries for elements in x with negative
argument.
b. Plot x Vs y. For the plots, make sure that the labels of x & y axes represent appropriate
scale & units. Give proper titles to the plots.
c. Export the plot, in the form of an image, and paste into a word document (your
record book).
Function generator
3. Once you powered up the function generator, the default signal shows an output of
__sine_____
with
an
amplitude
of
100mVpp_____(peak-to-peak).
4. Mention only different types of signals available in your function generator?
Sine , Square , Ramp, Pulse, Noise, Arbitary
5. What are the range of amplitudes and frequencies of different signals that can generate in
your Function generator?
Sine: 1 microHz to 20MHz, 20Vpp
Square: 1 microHz to 20MHz, 20Vpp
Ramp: 1 microHz to 20MHz, 20Vpp
Pulse: 500microHz to 5MHz, 20Vpp
Noise: Guassian noise with a 10Mhz bandwidth.
Arb : Output is a arbitrary waveform with up to 64 K points and reception rate up
to 6MHz.
A sine wave of 100 kHz, 1Vpk-pk. Add an offset voltage of 1 mV to the given sine
wave and observe the signal.
(ii)
(iii)
Oscilloscope
Any time you develop a new circuit, repair an electronic instrument, or measure the performance
of an electronic component or system, you will need to use one or more items of test equipment.
Almost every task requires an oscilloscope, the basic instrument for visualizing the time
dependence of electronic signals.
Generate the following waveforms from the Function generator and display it on the
oscilloscope
(If you have trouble getting the scope to trigger at high frequencies, try pushing AUTO
SETUP to restore the default settings.)
(i)
Is the wave form stable or scrolling horizontally?
It is scrolling horizontally.
(ii)
How do you make it not to scroll and be stable in the display window?
Press the STOP button.
(2) 10 kHz square waves with low value at 1 V and high value at + 5.0 V.
(i)
Do the scope scales agree with the output of the function generator?
No, the scope scale does not agree with function generator
(ii)
If not, correct your DSO, Function Generator scope and probe settings
Change probe setting attenuation to 1X
(i)
4. Pulse at a frequency of 1 kHz, with low level at 1 V and high level at + 5.0 V and a width
of 200 s
(i)
Measure the time period, pulse duration and calculate their ratio?
Pulse width =800 microseconds
(ii)
Can you make use of this to find the rising and falling edge of a pulse?
Rising Edge=1.588 microseconds
Falling Edge = 1.604 microseconds
Generation of Signals:
Signal generation is a very basic component in experiments related to signals and systems. This
experiment is intended to learn about the signal generation using EMONA Telecom-Trainer 101
kit and, measurements of amplitude, frequency, phaseetc using Digital Storage Oscilloscope
(DSO). The DSOs in the lab have connectivity to the PC and the screenshots should be
transferred to PC for further analysis.
Td=2.5us T=10us.Td/T*2pi=pi/2
Offset for sine =280mV
Offset for cos=64.1mV
2. Using Master Signals module on the Emona kit and generate 2 kHz and 8 kHz digital signals,
a. Connect these signals to channels 1 and 2 of the DSO and obtain stable waveforms using Auto
set mode.
b. Use the horizontal scale knob and obtain 1 OFF (low) and 1 ON (high) of 2 kHz signal,
during the ON duration of the 2 kHz how many ON durations of 8 kHz signal do you find on
the DSO screen and note it down. Justify the answer.
Capture the waveform in the PC and transfer to your record.
c. Put the channels in DSO to DC coupling mode and measure the offset in DC using 'mean'
voltage setting in the channel
Measure the amplitude (peak-to-peak), and the period of the above generated signals.
Note: Learn to use the X and Y cursors of the DSO for measurement of voltage and time
period. Write down your observations.
Ans)2 KHz and 8 KHz digital signals
a. Ensure that both the knobs are in their minimal position i.e. turn the knobs completely in
anticlockwise direction using available screw-driver.
b. Use 8 kHz digital input from the master signal module and connect to CLK in the twin pulse
generator module. Connect the DSO channel 1 to Q1 output, obtain stable waveforms using
Auto set mode. Measure the following;
c. amplitude (pk-pk),
Ans) 5.2V
d.
frequency
Ans)8.333 KHz
e. measure the high and low values of the pulse using amplitude cursors 1 and 2, the difference
between the low and high values you measured does this correspond to pk-pk amplitude
measured in part (i).
Ans)yes we get 5.2V.
f. measure the width of the pulse (on time) using time cursors 1 and 2,
Ans) we get 122us as width
g. measure inter-pulse duration using time cursors 1 and 2, note the value, what is the
corresponding pulse repetition frequency?, how does this value match with the digital signal you
have used on the Emona kit ?.
Ans)inter pulse duration is 114us and frequency is 8.3 Khz.
4. Set the type in channel 1 to Pos Width option and turn the width knob clockwise to increase
the pulse width to about (approximately) 25 micro secs.
a. Write your observations. Capture the waveform in the PC and transfer to your record.
Ans)
b. Bring the width knob back to the original position, connect channel 2 of DSO to Q2 (of the
twin pulse generator module), using time cursors measure the delay between the two pulses
(between Channel 1 and 2) and note it down.
Ans)Delay is 42us
c. Rotate the delay knob to obtain a time shift of 75 micro secs. What kind of signal operation have
you performed? Capture the waveform in the PC and transfer to your record.
Ans)Time shifting
b. Is output an advanced version of the input? Rotate the phase knob in the clockwise direction such
that the output waveform becomes a delayed version of the input? Capture the waveform in the PC
and transfer to your record.
Ans) output as advanced version of input and delayed version of input
c. Rotate the knob completely to the extreme clockwise direction and comment on the nature of the
signal seen on the screen in terms of the phase shift and the time delay.Capture the waveform in
the PC and transfer to your record.
Ans)180 degree phase shift
d. Using time cursors measure the time difference between the location of the peaks of the both
signals. c) Also measure phase between channel 1 and 2 using DSO functionality. D) Now relate
the time period, time separation between the peaks of the signals and the phase. Write down your
observations?
Td=5us T=10us.phase diff=Td/T*2pi=pi
e. Work with the amplifier port A knob to increase or decrease the amplitude of the channel 2 signal.
What kind of signal operation do you think you have performed?Capture the waveform in the PC
and transfer to your record.
Ans)
f. Locate the buffer module in the Emona Kit. Rotate the gain knob to minimum position i.e. in
anticlockwise direction.
g. Connect output of GA+gb port to input of the buffer. Now connect channel 2 of the DSO to the
buffer output port, using autoset in DSO acquire the signal. If you do not see any signal in
channel 2 slightly rotate the gain knob in the buffer block. If you compare the signal in part d from
channel 1 with the part f) channel 2 what do you observe. What you think has happened to the
signal when you passed it through the buffer? Capture the waveform in the PC and transfer to your
record.
Ans)Amplitude is reversed again
h. Work with the gain knob of the buffer amplifier and make your observations. Capture the
waveform in the PC and transfer to your record.
Ans)
E. Random Signal
8. Locate noise generator module connect channel 1 of DSO to 0dB port of noise generator what do
you observe. Capture the waveform in the PC and transfer to your record.
Ans) noise
To generate input signals with same property but for the delay you may use the
outputs from Twin pulse generator and its delay feature. Use 2 kHz digital as
CLK input for the twin pulse generator.
(ii)
Using the output from Twin pulse generator, Adder and Buffer modules
generate a signal x(t) of the following type (as shown in Figure 1) and observe it in
channel 1 of DSO.
(iii)
Use the external trigger feature of DSO with input from 2 kHz digital of Master
signals generator. (Need for this step will be explained later)
FIGURE 1
(iv)
Assume that the given SYSTEM is Channel BPF on EMONA kit. Using the above
signal settings, connect as below
Now, you will observe in DSO, for two distinct input pulses (as shown in Figure 1) two distinct
responses in Channel 2. After this observation,
Perform the following steps:
1) Take out B input to the adder, and using time cursors of DSO, record the starting location
of the input pulse and starting location of the response.
Delay is : 6 microseconds
2) Connect back B input and take out A input, using time cursors of DSO, again record the
starting location of the input pulse and starting location of the response.
Delay is : 6 microseconds
3) Can you deduce whether the above system (channel BPF) is time invariant from the
above observations (1) and (2) ?
Yes the system is time invariant because the time delay between
the input and output response for various inputs is the same.
Procedure :
1) Let the system be RC LPF on EMONA kit
2) Let x1(t) = 2.5*sin(2*pi*2000*t), you may use Master signals generator and Adder
modules with gains to get the required amplitude for the signal
y1(t)
SYSTEM
Graph of y3(t):
Graph of y4(t):
For 1.2*y1(t):
For y3(t):
For 0.8*y2(t):
For y4(t):
x3(t)+x4(t)
y5(t)
SYSTEM
14) Using the waveform data capture option of the Tek Open choice Desktop software.
Get the channel 2 waveform data (i.e. y5(t)) into a .csv file format (say file-5.csv) on
the desktop.
15) Would you think that y3(t) + y4(t) = y5(t) ?
yes
16) To verify this import all .csv files into matlab and check the above equation.
1) x3(t) = 1.2*x1(t) and x4(t) = 0.8*x2(t). Let the corresponding system outputs be y3(t) and
y4(t) respectively.
2) Capture the waveforms y3(t) and y4(t).
3) Perform the operations as shown in block diagram below
x3(t)+x4(t)
y5(t)
SYSTEM
4) Capture y5(t).
NAME:IYER VISHNUVARDHAN V
ID NO.:2013AAPS049H
SEC-2
Generation of Continuous Time Signals
In order to understand the nature of different signals that we come across in electrical engineering
and to study the behavior of various systems for different input signals, Matlab can be used
extensively.
One may note here that all the signals that we generate and the systems we consider for
simulating in Matlab, are discrete time signals and discrete time systems only. However,
assuming the time interval between the discrete events to be sufficiently small, continuous time
system can be simulated and experimented to study their behavior.
In this experiment we learn to simulate the common signals that we use in analyzing the systems.
Write Matlab programs for generating the following signals and plot them using subplot
command. Also, make sure to use : x-Label, y-label, Axis, Grid, Title appropriately.
You may use the following code snippet as an example for generating time vector of resolution 1
msec.:
%-------------% Time axis for signals
dt = 0.001;
% Time axis resolution 1 msec
Stime = 0;
% Start Time of the time axis. In this example it is 0 seconds
Etime = 10;
% End time of Time axis. In this example it is 10 seconds
Mytime = [Stime:dt:Etime]; % Total time axis
% You may change the Stime and Etime as per the need.
Ex a mple 1 --------------- --------- -------- ----------------- ----------------- -------- ------------
--------------------------------------------------------------------------------------------------------------------(1) Generate the following signals using Matlab code, and plot. Show the time and amplitude
scales :
a. A ramp signal starting at time = 345 msec and ending at time = 15.35 seconds and reaching
a maximum value of 2.3 volts.
b. A cosine wave signal of frequency 10 Hz, starting at time = 0 msec and ending at time =
15.356 seconds and reaching a maximum value of 1.3 volts.
(-2t)
c. The exponential signals: x = e
, starting at t = 0.5 sec and ending at t = 200.456 sec.
d. A sawtooth periodic signal with parameters.Amplitude = 1 and period T = 0.2 s Make sure
the time resolution is of 1 millisecond and the time duration of signals is 10 seconds.
Ramp signal
Cosine signal
1.4
1. 5
1.2
1
0. 5
0.8
A mplitu
de
Voltage
0.6
0.4
-1
0.2
0
0
-0.5
8
Time
10
12
14
-1. 5
0
16
Exponential signal
12
14
16
1
0.8
A mplitude
0.3
A mplitude
10
Sawtooth signal
0.4
0.2
0.1
0
0
8
Time
0.6
0.4
0.2
50
100
150
200
250
T ime
0
0
5
Time
10
ltime = 1;
utime = 3;
y=x.*(t>=ltime& t<utime)
% You may change the ltime and utime as per the need.
(2)
A. Windowing of given signals
a. Generate a sine wave signal x(t) of frequency 0.5 Hz, starting at time = -5 sec and ending at
time = 10 seconds and reaching a maximum value of 2 volts using Matlab Plot command.
Sine signal
1
0.8
0.6
0.4
Amplitude
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-5
-4
-3
-2
-1
0
Time
b. Sketch the same sine wave windowed between 0 to 4 seconds and name it as signal y(t).
y(t)
1
0.8
0.6
0.4
Amplitude
0.2
0
-0.2
-0.4
-0.6
-0.8
-1
-5
-4
-3
-2
-1
0
Time
e. Plot signal y(t) using matlab in same figure window as x(t) using subplot command.
Show the time scale and labels. Index the plots using text command.
Sine signal
1
Amplitude
0.5
x(t)
0
-0.5
-1
-5
-4
-3
-2
-1
0
Time
y(t)
Amplitude
0.5
y(t)
0
-0.5
-1
-5
-4
-3
-2
-1
0
Time
for ( 2 t 5)
x(t)
7
Amplitude
x(t)
4
0
-4
-2
4
Time
10
12
d. Consider the time delayed signal y(t) = x(t+4.25). Generate y(t) and plot, overlaying on the
plot for x(t), using red color. Show the time scale and labels. Index the plots using
text command.
5.5
Amplitude
5
x(t)
y(t)=x(t+4.25)
4.5
3.5
-4 -2 0 2 4 6 8 10 12
Time
e. Consider the time advanced signal z(t) = x(t-4.25). Generate z(t) and plot, overlaying on
the earlier plot, with x(t) and y(t), using green color . Show the time scale and labels.
Index the plots using text command.
5.5
Amplitude
5
z(t)=x(t-4.25)
4.5
x(t)
y(t)=x(t+4.25)
3.5
2.5
-4
-2
4
Time
10
x(t)
0.6
0.5
0.4
0.3
0.2
0.1
0
-4
-3
-2
-1
0
Time
c. Consider the time folded signal y(t) = x(-t) . Generate y(t) and plot, overlaying on the plot
for x(t), using red color. Show the time scale and labels. Index the plots using text
command.
0.9
0.8
0.7
0.6
x(t)
y(t)=x(-t)
0.5
x(t)
0.4
0.3
0.2
0.1
0
-2
-1.5
-1
-0.5
0
Time
0.5
1.5
Part A
Systems
Three systems are available for you to study its impulse response and to understand convolution
operation; These systems are a) system1, b)system2, and 3) system3.
Test signals
(1) Use the time vector t=0:0.001:0.2; given in the above sample program for generating the
signalsbelow for the given specifications, pk-pk amplitude is 2 V
i.
ii.
iii.
iv.
v.
Half wave rectified cosine waveform with Amplitude = 1 and f = 10 (Test signal5)
(2) Use the above given sample code and perform the following
a)
b)
c)
d)
e)
Take system2 and study its impulse response. Record your observations.
Write matlab code to generate Testsignal1.
Input the above generated Testsignal1 to the system2.
Convolve the impulse response to the test signal 1
Now compare the outputs from steps 3 and 4. Do they match?
(3) Repeat the above steps for each Testsignals given above, record your observations.
(4) Repeat the above steps for each test signal given above using system 3. Record all your
observations
.
System 1:
Cosine half wave
Sawtooth
Triangular
System 2:
Triangular
Rectified cos
Square f=20
Sawtooth
Square 5
System 3:
Triangular
Square f=20
Square f=5
Sawtooth
3) Write Matlab code for reconstructing the signal using FS coefficients. The reconstruction
should be limited to the duration t1=9 sand t2=13 s.(T0= 4 s)
4) Consider n=5 and use the above code to reconstruct the signal (f(t))during t=9 sand t=
1
13 s.(T = 4 s)and overlay the plots of the reconstructed signal and the given f(t).
5) Compute the mean square error E = (1/N) (f(t)f(t)) ,where N is the length of the signal
vector
The above shows overlay of constructed signal form Fourier transform for
n=5 vs n=100
(Rising and falling edge )The rising and fall time has increased .
(the flat region 3V) the flat region is sinusodial not straight as the original.
( the flat region 0V) the flat region is sinusodial is not straight as original
The above shows overlay of constructed signal form Fourier transform for n=10 vs n=100
(Rising and falling edge )The rising and fall time has increased .
(the flat region 3V) the flat region is sinusodial not straight as the original.
( the flat region 0V) the flat region is sinusodial is not straight as original
The above shows overlay of constructed signal form fourier transform for n=20 vs n=100
(Rising and falling edge )The rising and fall time has increased and now is
closer to original
(the flat region 3V) the flat region is not straight as the original, but the
deviation hadecreased
( the flat region 0V) the flat region is s not straight as original but the
deviation has decreased
The above shows overlay of constructed signal form fourier transform for n=50 vs n=100
(Rising and falling edge )The rising and fall time is now is closer to original
(the flat region 3V) the flat region is not straight as the original, but the
deviation is minimal preturbations from the original
( the flat region 0V) the flat region is s not straight as original but the
deviation is minimal preturbations from the original
The above shows overlay of constructed signal form fourier transform for n=500 vs n=100
(Rising and falling edge )The rising and fall time is now is enhanced and is now
same to original
(the flat region 3V) the flat region is not perfect straight as the original, but
the deviations can be neglected
( the flat region 0V) the flat region is not perfect straight as the original, but
the deviations can be neglected.
6) Repeat steps 4 & 5 for n=10, 20, 50, 100, 500.
n
En vs n graph
8) For n=100, evaluate the reconstructed signal f(t) for a time duration 0 to 20 sand
plot. How is this different from original f(t)? Comment on your observation.
The Fourier spectra are the values of a and c = (a *a + b *b )for various values of n.
a) Write Matlab code for computing cfor n=5. Plot (n*)Vs cWhat is thespectral
n
0 n.
separation between the adjacent spectral points? Does this separation depend on
the number of terms used in FS based
reconstruction?
0
Ans : the difference between the adjacent spectral points is ( )which depends upon the T0 so if
0
T0 is changed , ( ), so if we take a region on the x axis for observation with increase in the T0
b) Consider the signal from t1=7 sand t2=15 s.(T0= 8 s). Using the Matlab code
developed before, compute a,a,and bfor n= 100and Plot (n*)Vs cWhat is
0n
0 n. .
thespectral separation between the adjacent spectral points? How is this different
from the one in part (a). Comment on your observations.
The
As mentioned T0 has changed the ( )will also changes the separation between the adjacent
spectral points now we see more points in the same amount of space.
c) Repeat (b) for t=3 sand t=19s.(T= 16 s). What is the impact on the spectral
separation
1
Vin
Vout
Figure 1
1. What type of filter is this? (LPF/HPF/BPF/BSF) Justify your answer heuristically.
BPF
This Circuit is a combination of a Capacitor and Inductor in Parallel . A Capacitor is a
Low-Pass Filter and an Inductor is a High Pass Filter . So , a combination of these two
will lead to a filter which allows a specific range of frequencies depending on the values
of L and C , therefore , a Band Pass Filter .
2. Derive an expression for the magnitude square of the transfer function |()|2 of the
circuit in your note book.
3. Write Matlab program to Plot the magnitude square of the transfer function taking
frequency f on x axis using subplot
4. Write Matlab program to normalize the above magnitude plot using the expression
given below and plot it using subplot
|()|
]
(|()|)
|()| = 1010 [
H2 = sqrt(H(f));
A = 10*log(H(f).*H(f));
Plot(log(f),A);
5.
Choose the frequency values such that you cover the |H(f)| (normalized) values in the range
of 0 dB to -20 dB. Use semilog scale for the frequency axis and dB for Y-axis.
6. From the frequency response, Note down the 3 dB cut off points. What is the Bandwidth
of this filter?
4.31 KHz and 5.91 KHz
7. Using the circuit board provided, connect the circuit as given in figure 1.
8. Adjust the output voltage of the Analog Function Generator (AFG) to 1 Volt peak to
peak and select the signal to be a 1000 Hz sine wave and connect the AFG to the input
of the circuit. Connect the input and output of the circuit to channel1 and channel 2 of
DSO, respectively.
9. For various values of the input sinusoid frequencies, note the input and output
amplitudes of the signal (Use DSO). Calculate the gain of the filter for various
frequency values and tabulate them. Make sure that you select the frequencies so as
to cover the frequency response you obtained using Matlab.
10. Use Matlab to plot the frequency (semilog scale) Vs normalized power gain (gain
normalized to maximum gain) (dB) for the circuit you connected.
11. Compare the plots, obtained in question 9, with those of Question 4, and obtained
using Matlab. Comment on the discrepancies if any.
Additional Problem
Frequency Response Characteristics of Channel Band Pass filter on Emona kit. :
Locate the VCO Module on the Emona kit.
Set the sliding switch to HI Position.
Set the rotating frequency knob to left most position.
Connect the sine output to input of the channel BPF Module.
Connect the input and output of the Channel BPF to channel 1 and channel 2 of DSO,
respectively.
6. By varying the frequency knob in VCO, for various values of the input sinusoid
frequencies, note the input and output amplitudes of the signal (Use DSO). Calculate
the gain of the filter for various frequency values and tabulate them. Continue the
experiment till the knob is turned to the right most position completely.
7. Use Matlab to plot the frequency (semilog scale) Vs normalized power gain (gain
normalized to maximum gain) (dB).
8. From the plot, Tabulate the following measurements for the above filters.
1. 3dB bandwidth
2. Maximum Pass band ripple
3. Maximum Stop band ripple
4. Roll off in terms dB/KHz at 3dB, 6dB and 12 dB points
1.
2.
3.
4.
5.