Experiment - 1: Aim: Software Used: Theory
Experiment - 1: Aim: Software Used: Theory
THEORY :-
● MATLAB is used for machine learning, signal processing image processing, computer
vision,communucations,computational finance,control design,robotics,and much more.
● MATLAB platform is optimized for solving engineering and scientific problems. The matrix-based MATLAB
language is the world’s most natural way to express computational mathematics.
● MATLAB code can be integrated with other languages,enabling you to deploy algorithms and applications
within web, enterprise , and production system.
● MATLAB allow matrix manipulations, plotting of function and data,implementation of algorithms,creation of
user interfaces, and interfacing with programs written in other language.
PRIMARY COMMANDS:-
● Help lists all primary help topics in the command window. Each main help topic correspods to a folder name
on the MATLAB search path.
● Help name displays the help text for the functionality specified nby name,such as a function , method, class,
toolbox or variable.
● Plot draw a plot,see also figure, axis , subplot.
● Print print the current plot window up into pieces,see also plot,figure.
● xlable/ylable add a label to the horizontal/vertical axis of the current plot,see also title,text,gtext. PROS. &
CONS.:-
PROS. CONS.
MATLAB contain a lot of advance toolboxes such as There is not as much open source code available
signal processing, wavelet,etc.Find analogous because MATLAB requires a license.
funtionality in other language is possible but difficult.
Good documentation. You cannot integrate your code into a web service.
Good customer support. MATLAB is expensive.
OUTPUT:-
Akash 04396202822
RESULT:- The study of MATLAB and the various commands used in MATLAB is complete.
VIVA:-
language. MATLAB users come from various background of engineering , science,and economics.
START Select MATLAB icon.ON Microsoft window platform ,double-click,the MATLAB icon.
Click on the left side of the desktop title bar and select close.
Akash 04396202822
3. What are the various desktop tools and window used in MATLAB.
Start button and launch pad – Run tools and access documentation for all of your MathWorks products. Commoand
window—Run MATLAB functions.
Command history – View a log of the function you entered in the command window,copy them and execute
them.
Current directory browser – view MATALB files and related files,perform file operation such as open , and find
content.
Workspace browser – View and make changes to the. contents of the workspace.
MATLAB is an interactive program for numerical computation and data visualization . You can enter a command by
typing it at the MATLAB prompt’>>’ on the Command window.
Akash 04396202822
clear Removes variables from memory
exist Check for existence of file or variale.
global Declares variables to be global.
help Searches for a help topic.
5.Plotting commands
print Prints plot or saves plot to a file.
title Puts text at top of plot.
xlabel Adds text label to x-axis.
ylable Adds text label to y-axis.
axes Creates axes objects.
close Closes the current plot
Akash 04396202822
EXPERIMENT-2
AIM:- To plot unit step, unit impulse, ramp,exponatial functions & sinusoidal signals.
PROGRAM:-
X=sin(2*pi*t);
Subplot(3,2,1);
Plot(t,x); title(‘sine
wave’);
xlable(‘time’);
Ylabel(‘amplitude’); %Generation
of cosine wave
t=0:0.01:pi;
Y=cos(2*pi*t);
Subplot(3,2,2);
Plot(t,y);
ylabel(‘amplitude’);
n=0,N-1; r=n;
Subplot(3,2,3); stem(n,r);
title(‘Ramp signal’);
xlabel(‘time’);
ylabel(‘amplitude’);
Akash 04396202822
of a’); e=exp(a*n); subplot(3,2,4);
stem(n,e); title(‘Exponantial
signal’); xlabel(‘time’);
ylabel(‘amplitude’); %Generation
subplot(3,2,5); stem(n,s);
xlabel(‘time’); ylabel(‘amplitude’);
zeros(1,2)]; subplot(3,2,6);
function’); xlabel(‘time’);
ylabel(‘amplitude’);
Akash 04396202822
OUTPUT:-
RESULT:-
Plotting of unit step,unit impulse,ramp,exponantial function and sinusoidal signal using MATLAB software is
complete.
Akash 04396202822
EXPERIMENT-3
AIM:- To plot convolution of two linear function.
PROGRAM:-
clc; clear
all; close
all;
nx=0:1;
subplot(3,1,1);
stem(nx,x);grid on;
title(‘input sequence’);
xlabel(‘time’);
ylabel(‘amplitude’);
nh=0:2;
subplot(3,1,2);
ylabel(‘amplitude’);
%Convolution of x & h
Akash 04396202822
nyl=nx(1) + nh(1);
nyr=nx(length(x)) + nh(lenght(h));
ny=nyl:nyr; y=conv(x,h);
subplot(3,1,3); stem(ny,y);grid
xlable(‘time’);
ylabel(‘amplitude’);
OUTPUT:-
Akash 04396202822
EXPERIMENT-4
AIM: To plot auto correlation of two sequences.
THEORY:-
CROSS CORRELATION: In signal processing, cross-correlation is a measure of similarity of two series as a function of
the displacement of one relative to the other. This is also known as a sliding dot product or sliding inner-product. It
is commonly used for searching a long signal for a shorter, known feature. It has applications in pattern recognition,
single particle analysis, electron tomography, averaging, cryptanalysis, and neurophysiology.
AUTO CORRELATION: Autocorrelation, also known as serial correlation, is the correlation of a signal with a delayed
copy of itself as a function of delay. Informally, it is the similarity between observations as a function of the time lag
between them. The analysis of autocorrelation is a mathematical tool for finding repeating patterns, such as the
presence of a periodic signal obscured by noise, or identifying the missing fundamental frequency in a signal implied
by its harmonic frequencies. It is often used in signal processing for analysing functions or series of values, such as
time domain signals. Unit root processes, trend stationary processes, autoregressive processes, and moving average
processes are specific forms of processes with autocorrelation.
PROGRAM:-
clear all;
subplot(4,1,1);
stem(nx,x); grid on
Akash 04396202822
xlabel('Time');
ylabel('Amplitude');
xlabel('Time'); ylabel('Amplitude');
of x & x
x1=fliplr(x); n
* 1 = - 1/0 ;
nylac=nx(1)+nx1(1); nyrac=nx(length(x))+nx1(length(x1));
nylcc=nx(1)+nh1(1);
nyrcc=nx(length(x))+nh1(length(h1)); ycc=conv(x,h1);
correletion');
Akash 04396202822
OUTPUT:-
Akash 04396202822
EXPERIMENT-5
AIM:-To plot the magnitude and phase plot spectrum of signal using fourier series.
SOFTWARE USED:- R2017a
THEORY:-
Fourier series is just a means to represent a periodic signal as an infinite sum of sine wave components. A periodic
signal is just a signal that repeats its pattern at some period. The primary reason that we use Fourier series is that
we can better analyze a signal in another domain rather in the original domain. Fourier Series expansion is given
below,
The function abs (|Cn|) return the magnitude and anlge (<Cn) Vs n.
CODE/PROGRAM:-
t; T = pi w=2 *
pi / T; xt =
exp(- t / 2); n =
- 4:4;
%magnitude
(2, 1, 1)
Stem(n,magnitudeCn);
Grid on;
Xlabel(‘n’);
Ylable(‘|Cn|’);
Title(‘magnitude plot’);
Akash 04396202822
Subplot(2,1,2);
Stem(n,angleCn);
Grid on;
Xlable(‘n’);
Ylabel(‘<Cn’);
Title(‘phase plot’);
OUTPUT:-
RESULT:- The magnitude and phase plot spectrum of signal are plotted using Fourier series.
Akash 04396202822
EXPERIMENT-6
AIM:- To plot the magnitude and phase plot spectra of signal using Fourier Transforms.
THEORY:-
A function derived from a given function and representing it by a series of sinusoidal functions. The Fourier
Transform decomposes any function into a sum of sinusoidal basis functions. Each of these basis functions is a
complex exponential of a different frequency.
clc; clear
all; close
all;
syms t omega;
xt = 2;
expw = exp(-j*omega*t);
Akash 04396202822
OUTPUT:-
RESULT:-
The magnitude and phase plot spectra of signal are plotted using Fourier Transform.
Akash 04396202822
EXPERIMENT-7
AIM:- Determine and plot discrete time fourier time transform of the following:-
THEORY:-
In mathematics, the discrete-time Fourier transform (DTFT) is a form of Fourier analysis that is applicable to the
uniformly spaced samples of a continuous function. The term discrete time refers to the fact that the transform
operates on discrete data (samples) whose interval often has units of time. From only the samples, it produces a
function of frequency that is a periodic summation of the continuous Fourier transform of the original continuous
function. Under certain theoretical conditions, described by the sampling theorem, the original continuous function
can be recovered perfectly from the DTFT and thus from the original discrete samples. 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.
DTFT=
PROGRAM:-
n1 = - 2:2 ; xn1 =
ones(1, 5);
%rectangular function
k=-400:400; w= (pi /
100)*k; Xw=xn1^ *
^ (n1’* k));
Akash 04396202822
magXw1=abs(Xw);
subplot(2,2,1); stem(-8:8,[zeros(1,6)
subplot(2,2,3); plot(w/pi,magXw1);
xlabel('frequency in pi units');
ylabel('magnitude'); title('DTFT');
n2=0:100; xn2=cos(pi*n2/4);
%sinusoidal signal
Xw2=xn2*(exp(-1*j*pi/100).^(n2'*k)); magXw2=abs(Xw2);
subplot(2,2,2); stem(n2,xn2);
xlabel('n'); ylabel('xn');
title('sinusoidal signal');
subplot(2,2,4);
plot(w/pi,magXw2);
xlabel('frequency in pi units');
ylabel('magnitude'); title('DTFT');
Akash 04396202822
GRAPH:-
Akash 04396202822
EXPERIMENT-8
AIM:- Write a program of sampling at:
THEORY:-
The Nyquist Theorem, also known as the sampling theorem, is a principle that engineers follow in the digitization of
analog signals. For analog-to-digital conversion (ADC) to result in a faithful reproduction of the signal, slices, called
samples, of the analog waveform must be taken frequently. The number of samples per second is called the
sampling rate or sampling frequency.
Any analog signal consists of components at various frequencies. The simplest case is the sine wave, in which all the
signal energy is concentrated at one frequency. In practice, analog signals usually have complex waveforms, with
components at many frequencies. The highest frequency component in an analog signal determines the bandwidth
of that signal. The higher the frequency, the greater the bandwidth, if all other factors are held constant.
Suppose the highest frequency component, in hertz, for a given analog signal is fmax. According to the Nyquist
Theorem, the sampling rate must be at least 2fmax, or twice the highest analog frequency component. The
sampling in an analog to digital converter is actuated by a pulse generator (clock). If the sampling rate is less than
2fmax, some of the highest frequency components in the analog input signal will not be correctly represented in the
digitized output. When such a digital signal is converted back to analog form by a digital-to- analog converter, false
frequency components appear that were not in the original analog signal. This undesirable condition is a form of
distortion called aliasing.
PROGRAM:-
%sampling theorem
0:0.01:1; fm=input('enter
frequency fm');
function'); xlabel('time---->');
Akash 04396202822
ylabel('amplitude------->');
subplot(4,1,2);
plot(t,xt,'r',n1,xn1,'b');
title('undersmapling');
xlabel('time------->');
ylabel('amplitude------- >');
n2 = 0:1 / fs2:1 ;
xn2=cos(2* pi * fm * n2);
subplot(4,1,3); plot(t,xt,'r',
n2,xn2,'b'); title('nyquist
rate'); xlabel('time');
ylabel('amplitude');
xn3=cos(2*pi*fm*n3); subplot(4,1,4);
plot(t,xt,'r',n3,xn3,'b');
title('oversampling'); xlabel
(‘time------->’) ; ylabel('amplitude------
>');
Akash 04396202822
GRAPH:-
OUTPUT:-
Akash 04396202822