Beruflich Dokumente
Kultur Dokumente
1
Aim: Write a program to generate various signals like unit step, ramp, unit impulse, sinusoidal and
exponential signal
Theory: Some of the basic functions are as follows: 1. Unit Impulse Signal
The unit impulse signal, or signal, is a generalized signal that is zero
everywhere except at origin, with an integral of one over the entire real line. The signal is
sometimes thought of as a hypothetical function whose graph is an infinitely high.
1 , = 0
(t) = {
0 , 0
2. Unit Step Signal
The unit step signal, usually denoted by u, is a discontinuous signal
whose value is zero for negative argument and one for positive argument.
1 , > 0
u (t) = {
0 , < 0
3. Ramp Signal
A continuous time ramp type signal is denoted by r(t). Its value
increases linearly with sample number n. mathematically it is defined as,
, 0
r (t) = {
0 , < 0
4. Sinusoidal Signal
The sinusoidal signals include sine and cosine signals. Mathematically
they can be expressed as follows:
A sine signal: () = () = (2)
A cosine signal: () = () = (2)
5. Exponential Signal
A real exponential signal is defined as: () =
The case a > 0 represents exponential growth. Some signals in unstable systems exhibit
exponential growth.
The case a < 0 represents exponential decay. Some signals in stable systems exhibit exponential
decay.
Experiment No. 2
Aim: Write a program to perform time shifting, scaling and reversal operation on a sinusoidal
signal
Theory:
3. Reversal Operation
Reversal of signal is a very interesting operation applicable on both
continuous and discrete signals. Here in this case the vertical axis acts as the mirror, and the
transformed image obtained is exactly the mirror image of the parent signal.
It can be defined as
() = ( )
Where, X(t) is the original signal.
t = -2*pi:0.001:2*pi ;
y = sin(t) ;
x = sin(t-2) ;
subplot(2,1,1)
plot(t,y,'r'),grid on ;
subplot(2,1,2)
plot(t,x),grid on ;
t = -2*pi:0.001:2*pi ;
y = sin(t) ;
x = sin(2*t) ;
subplot(2,1,1)
plot(t,y,'r'),grid on ;
subplot(2,1,2)
plot(t,x),grid on ;
t = -2*pi:0.001:2*pi ;
y = sin(t) ;
x = sin(-t) ;
subplot(2,1,1)
plot(t,y,'r'),grid on ;
subplot(2,1,2)
plot(t,x),grid on ;
Experiment No. 3
Aim: To perform mathematical operations on a given signal
Code
close all
clear all
x = -4*pi:0.001*pi:4*pi;
y = sin(x);
z = cos(x);
a = y+z;
b = y-z;
subplot (2,2,1)
plot(x,y) , grid on;
xlabel('x'), ylabel ('sin x')
subplot (2,2,2)
plot(x,z) , grid on;
xlabel('x'), ylabel ('cos x')
subplot (2,2,3)
plot(x,a) , grid on;
xlabel('x'), ylabel ('(sin x) + (cos x)')
subplot (2,2,4)
plot(x,b), grid on;
xlabel('x'), ylabel ('(sin x) - (cos x)')
Experiment No. 4
Aim: To verify the linearity property of the signals
Code for Verification
close all
clear all
t = 0:0.001:4 ;
x1 = (t>=0) ;
y1 = t.*x1 ;
x2 = 3. *(t>2) ;
y2 = t.*x2 ;
x3 = x1 + x2 ;
y3 = t.*x3 ;
y4 = y1 + y2 ;
subplot (3,2,1)
plot (t, y1), title('y1') ;
subplot (3,2,2)
plot (t, y2), title('y2') ;
subplot (3,2,3)
plot (t, y3), title('y3') ;
subplot (3,2,4)
plot (t, y4), title('y4') ;
subplot (3,2,5)
plot (t, y3,'r, t, y4,'b:') ;
Experiment No. 5
Aim: Write a program to plot the convolution of two discrete signals without using
conv() function
Theory:
Convolution is a mathematical operation which can be perform on two
signals to produce a third signal which is typically viewed as the modified version of
one of the original signals. It relates input, output and impulse response of a linear
Time Invariant system as:
() = () ()
Where y (t) = output of Linear Time Invariant system
x (t) = input of Linear Time Invariant system
h (t) = impulse response of Linear Time Invariant system
There are two types of convolutions:
Continuous convolution
() = () () = ()( )
(or)
() = () ( )
Discrete Convolution
[] = [] [] = [ ][ ]
(or)
[] = [ ][ ]
Experiment No. 6
Aim: To find the response of a LTI system using convolution
Code
close all
clear all
a = 1:0.5:10 ;
b = exp(a);
c = 2*a ;
i = length(a);
j = length(b);
A = [a, zeros (1, i)];
B = [b, zeros (1, j)];
for k=1: i+j-1
z(k)=0;
for l=1: i
if(k-l+1>0)
z(k)=z(k)+A(l)*B(k-l+1);
end
end
end
subplot (2,1,1)
plot(z) ;
d = conv (b, c);
subplot (2,1,2)
plot(d) ;
Experiment No. 7
Aim: To find the Fourier Transform of the given signal
The DTFT itself is a continuous function of frequency, but discrete samples of it can be
readily calculated via the discrete Fourier transform (DFT) (see Sampling the DTFT),
which is by far the most common method of modern Fourier analysis.
Code
close all;
clear all;
x = [1 1 1 1 zeros(1,4)] ;
m=8;
X = fft (x, m) ;
magX = abs(X) ;
phase = angle(X)*180/pi ;
subplot (3,1,1)
stem(x) ;
subplot (3,1,2)
stem(magX), xlabel('k') , ylabel('|x(k)|') ;
subplot (3,1,3)
stem(phase), xlabel('k') , ylabel('degrees') ;
Experiment No. 8
Aim: To find the Fourier series of a given signal
Code
close all;
clear all;
t = 0:0.01:10 ;
x = [ones (1,201), zeros (1,99), ones (1,201), zeros (1,99), ones (1,201), zeros (1,99)];
T=3;
w = 2*pi/T ;
dtau = 0.01 ;
for k = -10:10
sum = 0 ;
i=1;
for tau = 0: dtau: T
exp_part = exp(-j*w*k*tau) *dtau ;
sum = sum + exp_part. *x(i) ;
i = i+1 ;
end
a(k+11) = sum ;
end
for i = 1:21
mag(i) = abs(a(i)) ;
phase(i) = angle(a(i)) ;
end
subplot (1,2,1)
stem(mag) ;
subplot (1,2,2)
stem(phase) ;