Oscilloscope and Function Generator: Objective
Oscilloscope and Function Generator: Objective
EQUIPMENT:
Function Generator
Oscilloscope
DISCUSSION:
What is an oscilloscope?
An oscilloscope is basically a graph-displaying device – it draws the graph of an electrical
signal. In most applications, the graph shows how signals change over time: the vertical (Y)
axis represents voltage and the horizontal (X) axis represents time. The intensity or brightness
of the signal is sometimes called the Z axis
This simple graph can tell you many things about a signal such as:
• The time and voltage values of a signal
• The frequency of an oscillating signal
• Whether or not a malfunctioning component is distorting the signal
• How much of a signal is direct current (DC) or alternating current (AC)
Function Generator:
The function generator is a supply that typically provides a sinusoidal, square and
triangular waveform for a range of frequencies. Although the dial position and appropriate
multiplier can set the frequency of the function generator and the oscilloscope can be used to
precisely set the output frequency. The scope can also be used to set the amplitude of the
function generator since most of the function generators simply have an amplitude control
with no level indicators.
The main characteristics that you will be concerned with in this class are:
• Shape: sine, square, or triangle waves.
• Frequency: inverse of the period of the signal; units are cycles per second (Hz)
• Vpp: peak to peak Voltage value of the signal
• DC Offset: constant voltage added to the signal to increase or decrease its mean or average
level.
PROCEDURE
Focus
This probe calibrates to focus the blurry image of signal on oscilloscope to get the better
readings of Vm and Frequencies.
Intensity
This probe helps to increase the brightness of signal so we get the defined and prominent
signals to get our readings
Vertical And Horizontal Position
These features are used to move your signal to origin.So its easier to get the Time Period and
Vm .You can move signal vertically and horizontally without changing any properties of the
signal.
Trigger Section
To make you signal stationary this feature is used.If you signal is moving rapidly w.r.t time
then its hard for you to get the readings so we make it stationary using trigger.
Output
Problem 1
Program Code
clear all
clc
T=input('Enter Desired Length in terms of time = ')
t=-T:1:T;
step=[zeros(1,T),ones(1,T+1)];
subplot(2,1,1)
plot(t,step)
xlabel('Time')
ylabel ('Amplitude')
title('Unit Step of desired length(continuous)')
subplot(2,1,2)
stem(t,step)
xlabel('Time')
ylabel ('Amplitude')
title('Unit Step of desired length(discrete)')
Output
Problem 1
Program Code
clear all
clc
T=input('Enter Shift(No) in terms of time = ')
t=-10:1:10;
step=[zeros(1,10),ones(1,11)];
subplot(2,2,1)
plot(t,step)
xlabel('Time')
ylabel ('Amplitude')
title('Orignal Signal (continuous)')
subplot(2,2,2)
stem(t,step)
xlabel('Time')
ylabel ('Amplitude')
title('Orignal Signal(discrete)')
subplot(2,2,3)
plot(t+T,step)
xlabel('Time')
ylabel ('Amplitude')
title('Signal After Shift (continuous)')
subplot(2,2,4)
stem(t+T,step)
xlabel('Time')
ylabel ('Amplitude')
title('Signal After Shift(discrete)')
Output
Program Code
clear all
clc
t=-5:1:5;
signal=[0,0,0,2,0,0,0,0,0,1,0]
subplot(2,2,1)
plot(t,signal)
xlabel('Time')
ylabel ('Amplitude')
title(' Signal for x1[n] = 2 ?(n + 2) - ?(n-4)(continuous)')
subplot(2,2,2)
stem(t,signal)
xlabel('Time')
ylabel ('Amplitude')
title('Signal for x1[n] = 2 ?(n + 2) - ?(n-4)(discrete)')
Output
Problem B
Program Code
clear all
clc
t=0:1:20;
un1=[zeros(1,10) ones(1,11)];
un2=[zeros(1,20) ones(1,1)];
un3=un1-un2;
un4=10*exp(-0.3*(t-10));
un5=un4.*un3;
un6=[ones(1,21)];
un7=t.*(un6-un1);
x2=un7+un5;
subplot(2,1,1)
stem(t,x2)
xlabel('time')
ylabel('Amplitude')
title('Signal for n(u[n]–u[n-10])+10exp(-0.3(n-10))(u[n-10]-u[n-20]
(DISCRETE))')
subplot(2,1,2)
plot(t,x2)
xlabel('time')
ylabel('Amplitude')
title('Signal for n(u[n]–u[n-10])+10exp(-0.3(n-10))(u[n-10]-u[n-20])
(COUNTINOUS)')
Output
Problem B
Program Code
clear all
clc
t=0:1:50;
an=cos(0.04*3.14*t)
plot(t,an)
w=0.02.*rand(1,51)
subplot(2,2,1)
stem(t,w)
xlabel('time')
ylabel('Amplitude')
title('Gaussian Random Noise')
subplot(2,2,2)
plot(t,w)
xlabel('time')
ylabel('Amplitude')
title('Gaussian Random Noise')
x3=an+w;
subplot(2,2,3)
stem(t,x3)
xlabel('time')
ylabel('Amplitude')
title('Signal for cos(0.04?n) + 0.02w[n](DISCRETE))')
subplot(2,2,4)
plot(t,x3)
xlabel('time')
ylabel('Amplitude')
title('Signal for cos(0.04?n) + 0.02w[n](CONTINUOUS))')
Output
Problem B
Program Code
clear all
clc
t=-10:1:9;
x=[5,4,3,2,1];
x4=[x x x x]
subplot(2,1,1)
stem(t,x4)
xlabel('time')
ylabel('Amplitude')
title('Periodic Signal(DISCRETE))')
subplot(2,1,2)
plot(t,x4)
xlabel('time')
ylabel('Amplitude')
title('Periodic Signal(CONTINUOUS))')
Output
Problem C
(i) Write a function to generate a sinusoid of given specifications: it should take six
parameters: Freq, Amplitude, Initial Phase, Sampling Freq., Start-Time, Stop Time.
Program Code
Defining Function
function [X,t]= ghgh(A,P,S,E,F,ST)
t=S:ST:E;
X=A.*cos(2*pi*F*t+P)
plot(t,X)
end
Parameter’s Input
clear all
clc
A=input('Enter Amplitude');
F=input('Enter Frequency');
P=input('Enter phase');
S=input('Enter Start Time');
E=input('Enter End Time');
s=input('Enter sampling Frequency');
ST=1/s;
Output
Problem C
Program Code
clear all
clc
A=input('Enter Amplitude');
F=input('Enter Frequency');
P=input('Enter phase');
S=input('Enter Start Time');
E=input('Enter End Time');
s=input('Enter sampling Frequency');
ST=1/s;
Command Window
Enter Amplitude 50
Output
Problem C
iii)Generate x0[n] = exp(j*n/3), for some range and see its real and imaginary
parts separately.
Program Code
Continuous
syms t
x=exp(1i*(t/3));
y=imag(x)
y1=real(x)
subplot(3,1,1)
ezplot(y1,[0 10])
subplot(3,1,2)
ezplot(y,[0 10])
Output
Discrete
Program Code
t=0:1:10;
x=exp(1i*(t/3));
y=imag(x)
y1=real(x)
subplot(2,1,1)
stem(t,y)
xlabel('Time')
ylabel('Amplitude')
title('Real part')
subplot(2,1,2)
stem(t,y1)
xlabel('Time')
ylabel('Amplitude')
title('Imaginary part')
Output
Question no 7.
Create a function with three arguments. The function should perform the
addition, subtraction and multiplication of three numbers 2, 3 & 4.
Program Code
clear all
clc
t=-10:1:10
x=exp(-0.1+0.3*j)*t
y=imag(x)
y1=real(x)
subplot(2,1,1)
stem(t,y)
xlabel('Time')
ylabel('Amplitude')
title('Real part')
subplot(2,1,2)
stem(t,y1)
xlabel('Time')
ylabel('Amplitude')
title('Imaginary part')
Output
LEARNING OUTCOMES