Signals Lab Record (MK)
Signals Lab Record (MK)
V SEMESTER
INDEX
EX. DATE NAME OF MARKS TEACHER’S
NO. EXPERIMENT SIGN
1. GENERATIONS OF DISCRETE
TIME SIGNAL
2. GENERATIONS OF CONTINOUS
TIME SIGNAL
3. BASIC OPERATIONS ON
SIGNALS
4. CONVOLUTION OF TWO
DISCRETE TIME SIGNALS
5. STABILITY OF DISCRETE TIME
SYSTEM
6. STABILITY OF CONTINOUS
TIME SYSTEM
7. VERIFICATION OF SAMPLING
THEOREM
8. GENERATION OF
BIOSIGNALS(EMG)
INTRODUCTION TO MATLAB
What is MATLAB ?
It stands for matrix laboratory. It is developed by the company, the MAT works, INC USA.It
is an interactive integrated, interrupted for numerical calculation, and symbolic calculation
and and scientific visualization. It is a programming language.
KEY FEATURES OF MATLAB:
High level language for technical computing development. Development environment for
managing codes, files & data. Interactive tools for interactive operation, design and problem
solving. Mathematical function for linear, algebra, statistical Fourier analysis, filtering,
optimization and numerical integration. 2D and 3D graphics function for visualizing data.
Tools for building custom user interface (CUI). Programming and developing is faster
because there is no administrative task such as declaring variable and allocating memory.
STARTING OF MATLAB: Double click the MATLAB icon which is on the desktop to
get a MATLAB commandprompt.
QUITING MATLAB:
Type quit or exit in the MATLAB command prompt. Quit or exit
>Function SCRIPT
script are program that when executed will have each of it command executed if they were
ended, the MATLAB command prompt script can use variable that are currently in the work
space.
FUNCTION:
Function are program that when executed written a specified output obtain from a given set
of input, function can see in variable , that are passed to it output and will only written
variable that are specified as output.
To make the user to write the program easier MATLAB include many standard function ,
each function is a block of port that accomplishes a specific task, MATLAB which contains
all of the standard function such as sine, cosine, log, exponential ,square root as well as many
other function
Output: 0.707
PLOTTING :
It is also easy to create plot in MATLAB .
Suppose you want to plot the sine wave as function of time, first make the time vector
Eg: >>t=0;2.5;7
>>r=sin
>>plot(t,y)
>>stem(t,y)
BASIC OPERATIONS:
RESULT:
AIM:
APPARATUS REQIRED:
PROGRAM:
clc; clear
all;
close all;
OUTPUT:
RESULT:
Thus a Matlab program for generation of discrete time signals is written and executed
successfully.
APPARATUS REQIRED:
PROGRAM:
clc; clear
all; close
all;
OUTPUT:
RESULT:
Thus a matlab program for generation of continuous time signals is written and executed
successfully.
AIM:
To write a matlab program to perform operations on signals.
APPARATUS REQIRED:
PC, Matlab Software
ALGORITHM:
Time shifting
1. Define the number of samples (N) and range of values for n.
2. Define the amplitude at every instant of n.
3. Generate the signal for the defined amplitude and n values.
4. Display the generated signal.
5. Apply the time shifting operation by adding or subtracting constants.
6. Generate the signal for the defined amplitude and newly assigned n values. 7. Display the time
shifted signal.
Time folding
1. Define the number of samples (N) and range of values for n.
2. Define the amplitude at every instant of n.
3. Generate the signal for the defined amplitude and n values.
4. Display the generated signal.
5. Apply the folding operations by interchanging left side of the amplitude to rightside and vice versa.
Also change the sign of the time instants.
6. Generate the signal for the defined amplitude and newly assigned n values.
7. Display the folded signal.
Amplitude Scaling
In the amplitude scaling, a signal y(n) resulting from a signal x(n), on amplitude scaling by area value
A becomes: y(n)=k x(n)
PROGRAM: clc;
clear all; close all;
%Amplitude scaling
n =0:5; x=[1,-
1,0,0,5,4];
a=2; y=a*x;
subplot(3,2,1)
stem(n,y);
xlabel('time')
ylabel('Amplitude')
title('Amplitude scaling')
OUTPUT:
RESULT:
Thus a Matlab program to perform operations on signals is written and executed successfully.
DATE:
EXP N0: 4
APPARATUS REQIRED:
PC, Matlab Software.
PROGRAM:
%convolution of sequence
subplot(3,1,1); stem(n,x);
xlabel('time');
ylabel('amplitude');
title('x(n)'); axis([-3
3 -2 4]); m=-1:2;
h=[2 -1 1 4];
subplot(3,1,2);
stem(m,h);
xlabel('time');
ylabel('amplitude');
title('h(n)'); axis([-3 3
-2 5]); k=-3:3;
y=conv(x,h);
subplot(3,1,3);
stem(k,y);
xlabel('time');
ylabel('amplitude');
title('y(n)=x(n)*h(n)');
axis([-3 3 -4 14]);
OUTPUT:
RESULT:
Thus a Matlab program to perform convolution of two signals is written and executed
successfully.
EXP N0: 5
DATE:
AIM:
To write a Matlab program to check the stability of a discrete time system.
APPARATUS REQIRED:
PC, Matlab Software
ALGORTHM:
1. Get the coefficients of numerator polynomial of transfer function.
PROGRAM:
%stability of a system num=[0.3
0.6 0.2]; den=[1 0.2 0.8];
H=tf(num,den);
zplane(num,den); if(isstable(H))
display('The system is stable')
else display('The system is
unstable') end
OUTPUT:
RESULT:
Thus a Matlab program to check the stability of a discrete time system is written and executed
successfully.
EXP N0: 6
AIM:
To write a Matlab program to check the stability of a continuous time system.
APPARATUS REQIRED:
PC, Matlab Software
ALGORTHM:
1. Get the coefficients of numerator polynomial of transfer function.
PROGRAM:
%Stability of Continuous System
num=[1]; den=[1 6 11 6];
H=tf(num,den); pzmap(H);
if (isstable(H)) display('The
system is stable') else
display('The system is unstable')
end
OUTPUT:
RESULT:
Thus a Matlab program to check the stability of a continuous time system is written and
executed successfully.
EXP N0: 7 DATE:
AIM:
To write a matlab program to verify Sampling theorem.
APPARATUS REQIRED:
PC, Matlab Software
THEORY:
The word sampling refers to the conversion of the continuous time signal into discrete time
signal. The CTS is converted into discrete signal by taking its value or samples at uniform
space points in time. The time between the two consecutive samples is called the sampling
theorem.
ALGORITHM:
1. Plot an arbitrary signal.
2. Convert the continuous time signal.
3. Then it is converted to discrete time signal, using sampling theorem.
4. Check the effect of aliasing, this can be expressed as fs>2fmax.
5. Check the Nyquist rate by taking fs=2fmax.
6. Check the sampling theorem fs>2fmax.
7. Plot the output waveform. 8. Stop.
PROGRAM:
% Program for CT Signals
t=-100:0.01:100;
fm=0.02;
x=cos(2*pi*fm*t);
subplot(2,2,1); plot(t,x);
xlabel('time');
ylabel('amplitude');
title('CT signals');
% Program for aliasing effect
n=-10:10; fs1=0.03;
x1=cos(2*pi*fm*n/fs1);
subplot(2,2,2); stem(n,x1);
xlabel('time');
ylabel('amplitude');
title('Aliasing Effect');
hold on;
plot(n,x1,'r');
% Program for nyquist effect
fs2=0.04;
x2=cos(2*pi*fm*n/fs2);
subplot(2,2,3);
stem(n,x2); xlabel('time');
ylabel('amplitude');
title('Nyquist effect');
hold on;
plot(n,x2,'g');
% Program for Reconstruction
m=-100:100; fs3=1;
x3=cos(2*pi*fm*m/fs3);
subplot(2,2,4);
stem(m,x3); xlabel('time');
ylabel('amplitude');
title('Reconstruction');
hold on;
plot(m,x3,'v');
OUTPUT:
RESULT:
Thus a Matlab program to verify sampling theorem is written and executed successfully.
EXP N0: 8 DATE:
AIM:
To write a Matlab program to generate EMG signals.
APPARATUS REQUIRED:
PC, Matlab Software
PROGRAM:
% Parameters
fs = 1000; % Sampling frequency (Hz)
duration = 2; % Duration of the signal (seconds)
t = 0:1/fs:duration-1/fs; % Time vector