SlideShare a Scribd company logo
ITM UNIVERSE Signal & System
140953109008 Page1 EE A
Lab 1: Introduction to MATLAB
AIM: Introduction to MATLAB
INTRODUCTION:
MATLAB stands for Matrix Laboratory. MATLAB is a high-performance language for
technical computing. It integrates computation, visualization, and programming in an easy-to-
use environment where problems and solutions are expressed in familiar mathematical
notation. Typical uses include
 Math and computation
 Algorithm development
 Data acquisition
 Modelling, simulation, and prototyping
 Data analysis, exploration, and visualization
 Scientific and engineering graphics
 Application development, including graphical user interface building.
The MATLAB System:
The MATLAB system consists of five main parts:
 Development Environment. This is the set of tools and facilities that help you use
MATLAB functions and files. Many of these tools are graphical user interfaces. It
includes the MATLAB desktop and Command Window, a command history, an
editor and debugger, and browsers for viewing help, the workspace, files, and the
search path.
 The MATLAB Mathematical Function Library. This is a vast collection of
computational algorithms ranging from elementary functions, like sum, sine, cosine,
and complex arithmetic, to more sophisticated functions like matrix inverse, matrix
eigen values, Bessel functions, and fast Fourier transforms.
 The MATLAB Language. This is a high-level matrix/array language with control
flow statements, functions, data structures, input/output, and object-oriented
programming features. It allows both "programming in the small" to rapidly create
quick and dirty throw-away programs, and "programming in the large" to create large
and complex application programs.
 Graphics. MATLAB has extensive facilities for displaying vectors and matrices as
graphs, as well as annotating and printing these graphs. It includes high-level
functions for two-dimensional and three-dimensional data visualization, image
processing, animation, and presentation graphics. It also includes low-level functions
that allow you to fully customize the appearance of graphics as well as to build
complete graphical user interfaces on your MATLAB applications.
 The MATLAB Application Program Interface (API). This is a library that allows
you to write C and Fortran programs that interact with MATLAB. It includes facilities
ITM UNIVERSE Signal & System
140953109008 Page2 EE A
for calling routines from MATLAB (dynamic linking), calling MATLAB as a
computational engine, and for reading and writing MAT-files.
MATLAB Desktop:
When we start MATLAB, the MATLAB desktop appears, containing tools (graphical user
interfaces) for managing files, variables, and applications associated with MATLAB. The
following illustration shows the default desktop. You can customize the arrangement of tools
and documents to suit your needs.
MATLAB Windows:
1. MATLAB Desktop:
It consists of following sub windows.
a) Command Windows: This is the main window. It is characterized by the MATLAB
command prompt (>>).
b) Current Directory: This is where all your files from the current directory are listed. You
can do file navigation here.
c) Workspace: It lists all variables that you have generated so far and shows their types and
sizes.
ITM UNIVERSE Signal & System
140953109008 Page3 EE A
d) Command History: All commands typed on the MATLAB prompt in the command
window get recorded, even across multiple sessions.
2. Figure Window:
The output of all graphics command typed in the command window is flushed to the figure
window.
3. Editor Window:
This is where you can write edit, create and save your own programs in files called m files.
MATLAB on the Windows System:On the windows systems, MATLAB is started by
double clicking the MATLAB icon on the desktop or by selecting MATLAB from the start
menu.
The starting procedure takes the user to the command window where the command line is
indicated with '>>'.
Help and information on MATLAB commands can be found in several ways.
 From the command line by using the ‘help <topic name>' command.
 From the separate Help window found under the Help menu.
Prototype M-Files:
When you use the mfile name option with load library, MATLAB generates an M-file called
a prototype file. This file can then be used on subsequent calls to load library in place of a
header file.
Scripts:
When you invoke a script, MATLAB simply executes the commands found in the file.
Scripts can operate on existing data in the workspace, or they can create new data on which to
operate. Although scripts do not return output arguments, any variables that they create
remain in the workspace, to be used in subsequent computations. In addition, scripts can
produce graphical output using functions like plot.
Functions:
Return information about a function handle
SyntaxS = functions(funhandle)
Description:
S = functions(funhandle) returns, in MATLAB structure S, the function name, type, filename,
and other information for the function handle stored in the variable funhandle.
ITM UNIVERSE Signal & System
140953109008 Page4 EE A
Aim 1: Define two random matrix A&B . find A+B,A-B,A*B,eigenvalues
of A, inverse of A, rank of A.
Software Required:
MATLAB 2013
Input:
A = [1 2;6 7]
A_eig=eig(A)
B = [2 7;9 1]
B_eig=eig(B)
A_inv=inv(A)
B_inv=inv(B)
A_rank=rank(A)
B_rank=rank(B)
Output:
A =
1 2
6 7
A_eig =
-0.5826
8.5826
B =
2 7
9 1
B_eig =
9.4530
-6.4530
A_inv =
-1.4000 0.4000
1.2000 -0.2000
B_inv =
-0.0164 0.1148
0.1475 -0.0328
A_rank = 2
B_rank = 2
ITM UNIVERSE Signal & System
140953109008 Page5 EE A
Aim 2: y=(x*2)+4*x+3 defined x from 0 to 200 in steps of 20.plotits discrete
samples.
Software Required:
MATLAB 2013
Input :
x=0:20:200
y=x.^2+4*x+3
stem(x,y);xlabel('x');ylabel('x^2+4*x+3');title('function');
output :
Aim3 : 0 to 360 steps of 10 y=(cos(x)).^2+4*sin(x).
Software Required:
MATLAB 2013
Input :
x=0:10:360
y=(cos(x)).^2+4*sin(x)
subplot(3,1,1),plot(x,cosd(x));xlabel('degrees');ylabel('amplitude');title('coswave');grid on;
subplot(3,1,2),plot(x,sind(x));xlabel('degrees');ylabel('amplitude');title('sinewave');grid on;
subplot(3,1,3),plot(x,y); xlabel('degrees');ylabel('amplitude');title(' y=(cos(x)).^2+4*sin(x)
0 20 40 60 80 100 120 140 160 180 200
0
0.5
1
1.5
2
2.5
3
3.5
4
4.5
x 10
4
x
x2+4*x+3
function
ITM UNIVERSE Signal & System
140953109008 Page6 EE A
');grid on;
Output:
Aim 5: Define x in degrees and plot cos (x), sin (x) and tan (x)
Software Required:
MATLAB 2013
Input:
(a) sin (x)
x = 0 : 0.1 : 2*pi;
y1 = sin(x);
plot(x, y1); ylabel('amplitude');title('sin wave');
ITM UNIVERSE Signal & System
140953109008 Page7 EE A
(b) cos (x)
x = 0 : 0.1 : 2*pi;
y2 = cos(x);
plot(x, y2) ; ylabel('amplitude');title('cos wave');
(c) tan (x)
x = 0 : 0.1 : 2*pi;
y3 = tan(x);
plot(x, y1) ; ylabel('amplitude');title('tan wave');
Output:
(a)
(b)
ITM UNIVERSE Signal & System
140953109008 Page8 EE A
(c)
ITM UNIVERSE Signal & System
140953109008 Page9 EE A
Conclusion:
After performing this experiment we studied about MATLAB and its basic operations and
functions.
ITM UNIVERSE Signal & System
140953109008 Page10 EE A
LAB. : 2 Signal Generation
Aim 1:Plot (a)sine wave and (b)cosine wave in continues time signal.
Software Required:
MATLAB 2013
Input:
(a) sin wave
f=50
Fs=1000;
Ts=1/Fs
nts=0:Ts:1/f
s=sin(2*pi*f*nts);
plot(nts,s);xlabel('time');ylabel('amplitude');title(‘sine wave’);grid on;
(b) cosine wave
f=50
Fs=1000
Ts=1/Fs
nts=0:Ts:1/f
s=cos(2*pi*f*nts);
plot(nts,s);xlabel('time');ylabel('amplitude');title('cos wave');grid on;
ITM UNIVERSE Signal & System
140953109008 Page11 EE A
output: (a)
(b)
ITM UNIVERSE Signal & System
140953109008 Page12 EE A
Aim 2:Plot (a)sine wave and (b)cosine wave in discrete time signal.
Software Required:
MATLAB 2013
Input:
(a)
f=50
Fs=input('sampling frequency');
Ts=1/Fs
n=0:Ts:Fs/f
s=sin(2*pi*f*n*Ts);
stem(n,s);xlabel('fre.');ylabel('amplitude');title('sin wave)');
(b)
f=50
Fs=1000
Ts=1/Fs
nts=0:Ts:1/f
s=cos(2*pi*f*nts);
stem(nts,s);xlabel('fre.');ylabel('amplitude');title('cos wave');
ITM UNIVERSE Signal & System
140953109008 Page13 EE A
Output: (a) &(b) respectively
0 2 4 6 8 10 12 14 16 18 20
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
fre.
amp. sine wave
0 2 4 6 8 10 12 14 16 18 20
-1
-0.8
-0.6
-0.4
-0.2
0
0.2
0.4
0.6
0.8
1
fre.
amp.
cosine wave
ITM UNIVERSE Signal & System
140953109008 Page14 EE A
Aim3:Plot unit ramp function (Both in CT & DT domain).
Software Required:
MATLAB 2013
Input:
(a)
Fs=200
Ts=1/Fs
n=-50:1:50
[a,b]=size(n)
for i=1:b
if n(i)>=0
ramp(i)=n(i)
else ramp(i)=0
end
end
plot(n,ramp);xlabel('n');ylabel('ramp');title ('Unit_Ramp');grid on
(b)
Fs=200
Ts=1/Fs
n=-50:1:50
[a,b]=size(n)
for i=1:b
if n(i)>=0
ramp(i)=n(i)
else ramp(i)=0
end
end
stem(n,ramp);xlabel('n');ylabel('ramp');title ('Unit_Ramp');grid on
output:
(a)
ITM UNIVERSE Signal & System
140953109008 Page15 EE A
(b)
ITM UNIVERSE Signal & System
140953109008 Page16 EE A
Aim4: plot unit step function.(Both in CT & DT domain)
Software Required:
MATLAB 2013
Input:
(a)
Fs=200
Ts=1/Fs
nTs=-2:Ts:2
[a,b]=size(nTs)
for i=1:b
if nTs(i)>0
step(i)=1
else step(i)=0
end
end
plot(nTs,step);xlabel('nTs');ylabel('step');title ('unit step');grid on
(b)
Fs=200
Ts=1/Fs
nTs=-2:Ts:2
[a,b]=size(nTs)
for i=1:b
if nTs(i)>0
step(i)=1
else step(i)=0
end
end
stem(nTs,step);xlabel('nTs');ylabel('step');title ('unit_step');grid on
output:
(a)
ITM UNIVERSE Signal & System
140953109008 Page17 EE A
(b)
ITM UNIVERSE Signal & System
140953109008 Page18 EE A
Aim5 :plot delta function in (a) continuos and (b) descrete time signal.
Software Required:
MATLAB 2013
Input:
(a)
Fs=200
Ts=1/200
nTs=-0.2:Ts:0.2
[a,b]=size(nTs)
for i=1:b
if nTs(i)==0
delta(i)=1
else
delta(i)=0
end;
end;
plot(nTs,delta);xlabel('nTs');ylabel('amplitude');title('delta continous');grid on;
(b)
Fs=200
Ts=1/200
nTs=-0.2:Ts:0.2
[a,b]=size(nTs)
for i=1:b
if nTs(i)==0
delta(i)=1
else
delta(i)=0
end;
end;
stem(nTs,delta);xlabel('nTs');ylabel('amplitude');title('Delta Discrete time');grid on;
output
(a)
ITM UNIVERSE Signal & System
140953109008 Page19 EE A
(b)
Aim 6: plot sinc function in (a)continous(b)descrete time signal.
ITM UNIVERSE Signal & System
140953109008 Page20 EE A
Software Required:
MATLAB 2013
Input:
(a)
f=50
Fs=2000
Ts=1/Fs
nTs=-.5:Ts:.5
s=sin(2*pi*f*nTs);
sinc_s=s./(2*pi*f*nTs);
plot(nTs,sinc_s);xlabel('time');ylabel('amplitude');title('sinc continuous signal');grid on;
(b)
f=50
Fs=2000
Ts=1/Fs
nTs=-.5:Ts:.5
s=sin(2*pi*f*nTs);
sinc_s=s./(2*pi*f*nTs);
stem(nTs,sinc_s);xlabel('time');ylabel('amplitude');title('sinc descrete signal');
Output:(a)
(b)
ITM UNIVERSE Signal & System
140953109008 Page21 EE A
CONCLUSION:
After performing this experiment we studied about different function and their waveform in
both continuous time and discrete time domain.
ITM UNIVERSE Signal & System
140953109008 Page22 EE A
LAB. : 3 Sampling Theorem
Aim 1 : Show effectof sampling effect of sampling frequency & prove
nyquist criteria for sampling.
Software Required:
MATLAB 2013
Input:
f=3
Fs1=1.5*f%Fs1<2*f
nTs1=0:1/Fs1:2/f
s=sin(2*pi*f*nTs1)
figure;
plot(nTs1,s);hold on; stem(nTs1,s);hold off;xlabel('nTs');ylabel('Amplitude');title('Discrete
sine wave Fs<2Fm');
f=3
Fs2=2*f%Fs2=2*f
nTs2=0:1/Fs2:2/f
s=sin(2*pi*f*nTs2)
figure;
plot(nTs2,s);hold on; stem(nTs2,s);hold off;xlabel('nTs');ylabel('Amplitude');title('Discrete
sine wave Fs=2Fm');
f=3
Fs3=5*f%Fs3>2*f
nTs3=0:1/Fs3:2/f
s=sin(2*pi*f*nTs3)
figure;
plot(nTs3,s);hold on; stem(nTs3,s);hold off;xlabel('nTs');ylabel('Amplitude');title('Discrete
sine wave Fs>2Fm');
ITM UNIVERSE Signal & System
140953109008 Page23 EE A
output:
ITM UNIVERSE Signal & System
140953109008 Page24 EE A
Aim 2 : Add different harmonics of sin wave having tone frequency 50 hz.
Software Required:
MATLAB 2013
Input :
f=2;
fs1=25*f;
t1=0:1/fs1:1;
s1=sin(2*pi*f*t1)+sin(2*pi*2*f*t1)+sin(2*pi*3*f*t1)+sin(2*pi*4*f*t1)+sin(2*pi*5*f*t1);
figure;
plot(t1,s1);xlabel('time');ylabel('amplitude');title('HARMONICS');hold on;
stem(t1,s1);hold off;
Output :
ITM UNIVERSE Signal & System
140953109008 Page25 EE A
CONCLUSION:
After performing this practical we studied about sampling frequency, nyquist rate and
sampling theorem by plotting graph of sin wave.
ITM UNIVERSE Signal & System
140953109008 Page26 EE A
LAB. : 4 :SIGNAL OPERATIONS
Aim 1 : Perform the time shifting, amplitude scaling, folding operationon
discrete time signal.
Input :
%%%%%%%%% exp %%%%%%%%%
clc;
clearall;
closeall;
t=15;
x=exp(1:5);
plot(x);
v=shift(x,3,t);
f=fold(x);
s_f=amp_scaling(x,3);
%%%%%%%% fold %%%%%%%%%%
function v=fold(x)
k=size(x,2);
v=[];
fori=k:-1:1;
v=[v x(i)];
end
end
%%%%%%%% shift %%%%%%%%%
function v=shift(s,n,t)
if n>0
v=[zeros(1,n) s zeros(1,t-abs(n)-size(s,2))];
elseif n<0
v=[s zeros(1,t-size(s,2))];
else
v=[s zeros(1,t-size(s,2))];
end
end
end
%%%%%%% amp_scaling %%%%%%
function v= amp_scaling(s,scal_factor)
v=s*scal_factor
ITM UNIVERSE Signal & System
140953109008 Page27 EE A
%%%%%% code %%%%%
clc;
clearall;
closeall;
t=15;
x=exp(1:5);
plot(x);
v=shift(x,3,t);
f=fold(x);
s_f=amp_scaling(x,3);
figure;
subplot(2,2,1);plot(x);xlabel('time');ylabel('amplitude');title('exponatial');
subplot(2,2,2);plot(v);xlabel('time');ylabel('amplitude');title('shifting');
subplot(2,2,3);plot(f);xlabel('time');ylabel('amplitude');title('folding');
subplot(2,2,4);plot(s_f);xlabel('time');ylabel('amplitude');title('scaling');
Output:
Conclusion:
We Performed the time shifting, amplitude scaling, folding operation on discrete time signal.
ITM UNIVERSE Signal & System
140953109008 Page28 EE A
LAB. : 5 Generation of Continuous Time Domain Signals
Aim 1 : Recording of own voice and displaying its discrete samples
Software Required:
MATLAB 2013
Input:
% Record your voice for 5 seconds.
recObj = audiorecorder;
disp('Start speaking.')
recordblocking(recObj, 5);
disp('End of Recording.');
% Play back the recording.
play(recObj);
% Store data in double-precision array.
myRecording = getaudiodata(recObj);
% Plot the waveform.
plot(myRecording);
Output: Voice is recorded for 5 sec and the graph of the voice signal is obtained.
ITM UNIVERSE Signal & System
140953109008 Page29 EE A
Aim 2 : Recordand save voice file with .wavextension
Software Required:
MATLAB 2013
Input :
clc;
%input
Fs=8000;
ButtonName= questdlg('press start to record your sound',...
'record',...
'START','STOP','START' );
switch ButtonName,
case 'START'
x=wavrecord(60000,Fs);
msgbox('Now you can hear the recorded sound', 'play');
wavplay(10*x,Fs);
case 'STOP'
errordlg('you dont want to record??? ','???')
x=0;
end
wavwrite(x,Fs,'C:UsersArpit PatelDesktop');
x
Output :
Voice is recorded by clicking start button and recording is stopped by clicking stop button
and then recording is saved in .wav extension.
Aim 3 : Reading existing wave file
Software Required:
MATLAB 2013
Input :
%%%%%%%******program 5******%%%%%%
%processing of speech signal
[x,Fs]=wavread('C:UsersArpit PatelDownloadsMusica');
ITM UNIVERSE Signal & System
140953109008 Page30 EE A
n=1:length(x);
plot(n,x)
title('plot of a.wav')
xlabel('time')
ylabel('amplitude')
wavplay(x,Fs)
Output :
File is read from the destination and wave form is plotted as below.
Conclusion:
We studied about different MATLAB functions to record sound, play it, save it and plot its
waveform of the recorded or saved .wav file.
ITM UNIVERSE Signal & System
140953109008 Page31 EE A
LAB. : 6 Linearity
Aim 1 : Check linearity of the given function
Software Required:
MATLAB 2013
Input:
(a) y1(n)=2x(n)+3
x1=input(' enter input 1');
x2=input(' enter input 2');
a1=input('weight of input 1');
a2=input('weight of input 2');
Y11=2*(a1*x1+a2*x2)+3;
Y12=(2*(a1*x1)+3)+(2*(a2*x2)+3);
if Y11==Y12
disp('sys is linear ');
else
disp('sys is non-linear ');
end;
(b)
x1=input(' enter input 1');
x2=input(' enter input 2');
a1=input('weight of input 1');
a2=input('weight of input 2');
Y21=cos((a1*x1)+(a2*x2));
Y22=cos(a1*x1)+cos(a2*x2);
if Y21==Y22
disp('sys is linear ');
else
disp('sys is non-linear ');
end;
ITM UNIVERSE Signal & System
140953109008 Page32 EE A
output:
(a)
(b)
CONCLUSION:
We studied about linearity property and check linearity of the function using MATLAB.

More Related Content

DOCX
PPTX
Matlab ppt
PDF
Basics of matlab
PDF
Matlab intro
PPTX
Matlab Introduction
PPTX
Matlab
PPTX
All About MATLAB
PPT
Introduction to matlab
Matlab ppt
Basics of matlab
Matlab intro
Matlab Introduction
Matlab
All About MATLAB
Introduction to matlab

What's hot (19)

PPT
Introduction to matlab
PPTX
Introduction to matlab lecture 1 of 4
DOCX
MATLAB BASICS
PDF
MATLAB Programming
PPT
Matlab introduction
PPT
Introduction to Matlab
PPT
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
PPT
Brief Introduction to Matlab
PPT
Matlab intro
PDF
Matlab Tutorial for Beginners - I
PPT
Introduction to matlab
PDF
Matlab
PPTX
What is matlab
PPTX
Matlab 1 level_1
PPT
Matlab Overviiew
PDF
Summer training matlab
PPTX
Seminar on MATLAB
PPSX
Matlab basic and image
PDF
Matlab intro
Introduction to matlab
Introduction to matlab lecture 1 of 4
MATLAB BASICS
MATLAB Programming
Matlab introduction
Introduction to Matlab
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
Brief Introduction to Matlab
Matlab intro
Matlab Tutorial for Beginners - I
Introduction to matlab
Matlab
What is matlab
Matlab 1 level_1
Matlab Overviiew
Summer training matlab
Seminar on MATLAB
Matlab basic and image
Matlab intro
Ad

Similar to KEVIN MERCHANT DOCUMENT (20)

PPTX
Summer training matlab
PDF
Matlab practical ---1.pdf
PDF
EE6711 Power System Simulation Lab manual
PDF
Introduction to Matlab for Engineering & Science Students.pdf
DOCX
Mmc manual
PPTX
From zero to MATLAB hero: Mastering the basics and beyond
DOCX
MATLAB guide
PPTX
Matlab introduction
PPTX
Matlab - Introduction and Basics
PDF
Introduction to MATLAB
PDF
Introduction to Matlab.pdf
PDF
interfacing matlab with embedded systems
PDF
An ntutorial[1]
PDF
A complete introduction on matlab and matlab's projects
DOCX
Signals And Systems Lab Manual, R18 Batch
PPTX
Introduction to matlab
DOC
Matlab tut2
PPTX
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
Summer training matlab
Matlab practical ---1.pdf
EE6711 Power System Simulation Lab manual
Introduction to Matlab for Engineering & Science Students.pdf
Mmc manual
From zero to MATLAB hero: Mastering the basics and beyond
MATLAB guide
Matlab introduction
Matlab - Introduction and Basics
Introduction to MATLAB
Introduction to Matlab.pdf
interfacing matlab with embedded systems
An ntutorial[1]
A complete introduction on matlab and matlab's projects
Signals And Systems Lab Manual, R18 Batch
Introduction to matlab
Matlab tut2
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
Ad

Recently uploaded (20)

PDF
Cours de Système d'information about ERP.pdf
PDF
How to Get Business Funding for Small Business Fast
PPTX
svnfcksanfskjcsnvvjknsnvsdscnsncxasxa saccacxsax
PPT
Chapter four Project-Preparation material
DOCX
unit 1 COST ACCOUNTING AND COST SHEET
PDF
Reconciliation AND MEMORANDUM RECONCILATION
DOCX
unit 2 cost accounting- Tender and Quotation & Reconciliation Statement
PDF
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
PPTX
Board-Reporting-Package-by-Umbrex-5-23-23.pptx
PDF
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
PDF
Roadmap Map-digital Banking feature MB,IB,AB
PDF
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
PPTX
Amazon (Business Studies) management studies
PDF
Power and position in leadershipDOC-20250808-WA0011..pdf
PDF
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
PDF
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
PDF
Chapter 5_Foreign Exchange Market in .pdf
PPTX
HR Introduction Slide (1).pptx on hr intro
PDF
IFRS Notes in your pocket for study all the time
PDF
Tata consultancy services case study shri Sharda college, basrur
Cours de Système d'information about ERP.pdf
How to Get Business Funding for Small Business Fast
svnfcksanfskjcsnvvjknsnvsdscnsncxasxa saccacxsax
Chapter four Project-Preparation material
unit 1 COST ACCOUNTING AND COST SHEET
Reconciliation AND MEMORANDUM RECONCILATION
unit 2 cost accounting- Tender and Quotation & Reconciliation Statement
Solara Labs: Empowering Health through Innovative Nutraceutical Solutions
Board-Reporting-Package-by-Umbrex-5-23-23.pptx
Katrina Stoneking: Shaking Up the Alcohol Beverage Industry
Roadmap Map-digital Banking feature MB,IB,AB
Outsourced Audit & Assurance in USA Why Globus Finanza is Your Trusted Choice
Amazon (Business Studies) management studies
Power and position in leadershipDOC-20250808-WA0011..pdf
kom-180-proposal-for-a-directive-amending-directive-2014-45-eu-and-directive-...
pdfcoffee.com-opt-b1plus-sb-answers.pdfvi
Chapter 5_Foreign Exchange Market in .pdf
HR Introduction Slide (1).pptx on hr intro
IFRS Notes in your pocket for study all the time
Tata consultancy services case study shri Sharda college, basrur

KEVIN MERCHANT DOCUMENT

  • 1. ITM UNIVERSE Signal & System 140953109008 Page1 EE A Lab 1: Introduction to MATLAB AIM: Introduction to MATLAB INTRODUCTION: MATLAB stands for Matrix Laboratory. MATLAB is a high-performance language for technical computing. It integrates computation, visualization, and programming in an easy-to- use environment where problems and solutions are expressed in familiar mathematical notation. Typical uses include  Math and computation  Algorithm development  Data acquisition  Modelling, simulation, and prototyping  Data analysis, exploration, and visualization  Scientific and engineering graphics  Application development, including graphical user interface building. The MATLAB System: The MATLAB system consists of five main parts:  Development Environment. This is the set of tools and facilities that help you use MATLAB functions and files. Many of these tools are graphical user interfaces. It includes the MATLAB desktop and Command Window, a command history, an editor and debugger, and browsers for viewing help, the workspace, files, and the search path.  The MATLAB Mathematical Function Library. This is a vast collection of computational algorithms ranging from elementary functions, like sum, sine, cosine, and complex arithmetic, to more sophisticated functions like matrix inverse, matrix eigen values, Bessel functions, and fast Fourier transforms.  The MATLAB Language. This is a high-level matrix/array language with control flow statements, functions, data structures, input/output, and object-oriented programming features. It allows both "programming in the small" to rapidly create quick and dirty throw-away programs, and "programming in the large" to create large and complex application programs.  Graphics. MATLAB has extensive facilities for displaying vectors and matrices as graphs, as well as annotating and printing these graphs. It includes high-level functions for two-dimensional and three-dimensional data visualization, image processing, animation, and presentation graphics. It also includes low-level functions that allow you to fully customize the appearance of graphics as well as to build complete graphical user interfaces on your MATLAB applications.  The MATLAB Application Program Interface (API). This is a library that allows you to write C and Fortran programs that interact with MATLAB. It includes facilities
  • 2. ITM UNIVERSE Signal & System 140953109008 Page2 EE A for calling routines from MATLAB (dynamic linking), calling MATLAB as a computational engine, and for reading and writing MAT-files. MATLAB Desktop: When we start MATLAB, the MATLAB desktop appears, containing tools (graphical user interfaces) for managing files, variables, and applications associated with MATLAB. The following illustration shows the default desktop. You can customize the arrangement of tools and documents to suit your needs. MATLAB Windows: 1. MATLAB Desktop: It consists of following sub windows. a) Command Windows: This is the main window. It is characterized by the MATLAB command prompt (>>). b) Current Directory: This is where all your files from the current directory are listed. You can do file navigation here. c) Workspace: It lists all variables that you have generated so far and shows their types and sizes.
  • 3. ITM UNIVERSE Signal & System 140953109008 Page3 EE A d) Command History: All commands typed on the MATLAB prompt in the command window get recorded, even across multiple sessions. 2. Figure Window: The output of all graphics command typed in the command window is flushed to the figure window. 3. Editor Window: This is where you can write edit, create and save your own programs in files called m files. MATLAB on the Windows System:On the windows systems, MATLAB is started by double clicking the MATLAB icon on the desktop or by selecting MATLAB from the start menu. The starting procedure takes the user to the command window where the command line is indicated with '>>'. Help and information on MATLAB commands can be found in several ways.  From the command line by using the ‘help <topic name>' command.  From the separate Help window found under the Help menu. Prototype M-Files: When you use the mfile name option with load library, MATLAB generates an M-file called a prototype file. This file can then be used on subsequent calls to load library in place of a header file. Scripts: When you invoke a script, MATLAB simply executes the commands found in the file. Scripts can operate on existing data in the workspace, or they can create new data on which to operate. Although scripts do not return output arguments, any variables that they create remain in the workspace, to be used in subsequent computations. In addition, scripts can produce graphical output using functions like plot. Functions: Return information about a function handle SyntaxS = functions(funhandle) Description: S = functions(funhandle) returns, in MATLAB structure S, the function name, type, filename, and other information for the function handle stored in the variable funhandle.
  • 4. ITM UNIVERSE Signal & System 140953109008 Page4 EE A Aim 1: Define two random matrix A&B . find A+B,A-B,A*B,eigenvalues of A, inverse of A, rank of A. Software Required: MATLAB 2013 Input: A = [1 2;6 7] A_eig=eig(A) B = [2 7;9 1] B_eig=eig(B) A_inv=inv(A) B_inv=inv(B) A_rank=rank(A) B_rank=rank(B) Output: A = 1 2 6 7 A_eig = -0.5826 8.5826 B = 2 7 9 1 B_eig = 9.4530 -6.4530 A_inv = -1.4000 0.4000 1.2000 -0.2000 B_inv = -0.0164 0.1148 0.1475 -0.0328 A_rank = 2 B_rank = 2
  • 5. ITM UNIVERSE Signal & System 140953109008 Page5 EE A Aim 2: y=(x*2)+4*x+3 defined x from 0 to 200 in steps of 20.plotits discrete samples. Software Required: MATLAB 2013 Input : x=0:20:200 y=x.^2+4*x+3 stem(x,y);xlabel('x');ylabel('x^2+4*x+3');title('function'); output : Aim3 : 0 to 360 steps of 10 y=(cos(x)).^2+4*sin(x). Software Required: MATLAB 2013 Input : x=0:10:360 y=(cos(x)).^2+4*sin(x) subplot(3,1,1),plot(x,cosd(x));xlabel('degrees');ylabel('amplitude');title('coswave');grid on; subplot(3,1,2),plot(x,sind(x));xlabel('degrees');ylabel('amplitude');title('sinewave');grid on; subplot(3,1,3),plot(x,y); xlabel('degrees');ylabel('amplitude');title(' y=(cos(x)).^2+4*sin(x) 0 20 40 60 80 100 120 140 160 180 200 0 0.5 1 1.5 2 2.5 3 3.5 4 4.5 x 10 4 x x2+4*x+3 function
  • 6. ITM UNIVERSE Signal & System 140953109008 Page6 EE A ');grid on; Output: Aim 5: Define x in degrees and plot cos (x), sin (x) and tan (x) Software Required: MATLAB 2013 Input: (a) sin (x) x = 0 : 0.1 : 2*pi; y1 = sin(x); plot(x, y1); ylabel('amplitude');title('sin wave');
  • 7. ITM UNIVERSE Signal & System 140953109008 Page7 EE A (b) cos (x) x = 0 : 0.1 : 2*pi; y2 = cos(x); plot(x, y2) ; ylabel('amplitude');title('cos wave'); (c) tan (x) x = 0 : 0.1 : 2*pi; y3 = tan(x); plot(x, y1) ; ylabel('amplitude');title('tan wave'); Output: (a) (b)
  • 8. ITM UNIVERSE Signal & System 140953109008 Page8 EE A (c)
  • 9. ITM UNIVERSE Signal & System 140953109008 Page9 EE A Conclusion: After performing this experiment we studied about MATLAB and its basic operations and functions.
  • 10. ITM UNIVERSE Signal & System 140953109008 Page10 EE A LAB. : 2 Signal Generation Aim 1:Plot (a)sine wave and (b)cosine wave in continues time signal. Software Required: MATLAB 2013 Input: (a) sin wave f=50 Fs=1000; Ts=1/Fs nts=0:Ts:1/f s=sin(2*pi*f*nts); plot(nts,s);xlabel('time');ylabel('amplitude');title(‘sine wave’);grid on; (b) cosine wave f=50 Fs=1000 Ts=1/Fs nts=0:Ts:1/f s=cos(2*pi*f*nts); plot(nts,s);xlabel('time');ylabel('amplitude');title('cos wave');grid on;
  • 11. ITM UNIVERSE Signal & System 140953109008 Page11 EE A output: (a) (b)
  • 12. ITM UNIVERSE Signal & System 140953109008 Page12 EE A Aim 2:Plot (a)sine wave and (b)cosine wave in discrete time signal. Software Required: MATLAB 2013 Input: (a) f=50 Fs=input('sampling frequency'); Ts=1/Fs n=0:Ts:Fs/f s=sin(2*pi*f*n*Ts); stem(n,s);xlabel('fre.');ylabel('amplitude');title('sin wave)'); (b) f=50 Fs=1000 Ts=1/Fs nts=0:Ts:1/f s=cos(2*pi*f*nts); stem(nts,s);xlabel('fre.');ylabel('amplitude');title('cos wave');
  • 13. ITM UNIVERSE Signal & System 140953109008 Page13 EE A Output: (a) &(b) respectively 0 2 4 6 8 10 12 14 16 18 20 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 fre. amp. sine wave 0 2 4 6 8 10 12 14 16 18 20 -1 -0.8 -0.6 -0.4 -0.2 0 0.2 0.4 0.6 0.8 1 fre. amp. cosine wave
  • 14. ITM UNIVERSE Signal & System 140953109008 Page14 EE A Aim3:Plot unit ramp function (Both in CT & DT domain). Software Required: MATLAB 2013 Input: (a) Fs=200 Ts=1/Fs n=-50:1:50 [a,b]=size(n) for i=1:b if n(i)>=0 ramp(i)=n(i) else ramp(i)=0 end end plot(n,ramp);xlabel('n');ylabel('ramp');title ('Unit_Ramp');grid on (b) Fs=200 Ts=1/Fs n=-50:1:50 [a,b]=size(n) for i=1:b if n(i)>=0 ramp(i)=n(i) else ramp(i)=0 end end stem(n,ramp);xlabel('n');ylabel('ramp');title ('Unit_Ramp');grid on output: (a)
  • 15. ITM UNIVERSE Signal & System 140953109008 Page15 EE A (b)
  • 16. ITM UNIVERSE Signal & System 140953109008 Page16 EE A Aim4: plot unit step function.(Both in CT & DT domain) Software Required: MATLAB 2013 Input: (a) Fs=200 Ts=1/Fs nTs=-2:Ts:2 [a,b]=size(nTs) for i=1:b if nTs(i)>0 step(i)=1 else step(i)=0 end end plot(nTs,step);xlabel('nTs');ylabel('step');title ('unit step');grid on (b) Fs=200 Ts=1/Fs nTs=-2:Ts:2 [a,b]=size(nTs) for i=1:b if nTs(i)>0 step(i)=1 else step(i)=0 end end stem(nTs,step);xlabel('nTs');ylabel('step');title ('unit_step');grid on output: (a)
  • 17. ITM UNIVERSE Signal & System 140953109008 Page17 EE A (b)
  • 18. ITM UNIVERSE Signal & System 140953109008 Page18 EE A Aim5 :plot delta function in (a) continuos and (b) descrete time signal. Software Required: MATLAB 2013 Input: (a) Fs=200 Ts=1/200 nTs=-0.2:Ts:0.2 [a,b]=size(nTs) for i=1:b if nTs(i)==0 delta(i)=1 else delta(i)=0 end; end; plot(nTs,delta);xlabel('nTs');ylabel('amplitude');title('delta continous');grid on; (b) Fs=200 Ts=1/200 nTs=-0.2:Ts:0.2 [a,b]=size(nTs) for i=1:b if nTs(i)==0 delta(i)=1 else delta(i)=0 end; end; stem(nTs,delta);xlabel('nTs');ylabel('amplitude');title('Delta Discrete time');grid on; output (a)
  • 19. ITM UNIVERSE Signal & System 140953109008 Page19 EE A (b) Aim 6: plot sinc function in (a)continous(b)descrete time signal.
  • 20. ITM UNIVERSE Signal & System 140953109008 Page20 EE A Software Required: MATLAB 2013 Input: (a) f=50 Fs=2000 Ts=1/Fs nTs=-.5:Ts:.5 s=sin(2*pi*f*nTs); sinc_s=s./(2*pi*f*nTs); plot(nTs,sinc_s);xlabel('time');ylabel('amplitude');title('sinc continuous signal');grid on; (b) f=50 Fs=2000 Ts=1/Fs nTs=-.5:Ts:.5 s=sin(2*pi*f*nTs); sinc_s=s./(2*pi*f*nTs); stem(nTs,sinc_s);xlabel('time');ylabel('amplitude');title('sinc descrete signal'); Output:(a) (b)
  • 21. ITM UNIVERSE Signal & System 140953109008 Page21 EE A CONCLUSION: After performing this experiment we studied about different function and their waveform in both continuous time and discrete time domain.
  • 22. ITM UNIVERSE Signal & System 140953109008 Page22 EE A LAB. : 3 Sampling Theorem Aim 1 : Show effectof sampling effect of sampling frequency & prove nyquist criteria for sampling. Software Required: MATLAB 2013 Input: f=3 Fs1=1.5*f%Fs1<2*f nTs1=0:1/Fs1:2/f s=sin(2*pi*f*nTs1) figure; plot(nTs1,s);hold on; stem(nTs1,s);hold off;xlabel('nTs');ylabel('Amplitude');title('Discrete sine wave Fs<2Fm'); f=3 Fs2=2*f%Fs2=2*f nTs2=0:1/Fs2:2/f s=sin(2*pi*f*nTs2) figure; plot(nTs2,s);hold on; stem(nTs2,s);hold off;xlabel('nTs');ylabel('Amplitude');title('Discrete sine wave Fs=2Fm'); f=3 Fs3=5*f%Fs3>2*f nTs3=0:1/Fs3:2/f s=sin(2*pi*f*nTs3) figure; plot(nTs3,s);hold on; stem(nTs3,s);hold off;xlabel('nTs');ylabel('Amplitude');title('Discrete sine wave Fs>2Fm');
  • 23. ITM UNIVERSE Signal & System 140953109008 Page23 EE A output:
  • 24. ITM UNIVERSE Signal & System 140953109008 Page24 EE A Aim 2 : Add different harmonics of sin wave having tone frequency 50 hz. Software Required: MATLAB 2013 Input : f=2; fs1=25*f; t1=0:1/fs1:1; s1=sin(2*pi*f*t1)+sin(2*pi*2*f*t1)+sin(2*pi*3*f*t1)+sin(2*pi*4*f*t1)+sin(2*pi*5*f*t1); figure; plot(t1,s1);xlabel('time');ylabel('amplitude');title('HARMONICS');hold on; stem(t1,s1);hold off; Output :
  • 25. ITM UNIVERSE Signal & System 140953109008 Page25 EE A CONCLUSION: After performing this practical we studied about sampling frequency, nyquist rate and sampling theorem by plotting graph of sin wave.
  • 26. ITM UNIVERSE Signal & System 140953109008 Page26 EE A LAB. : 4 :SIGNAL OPERATIONS Aim 1 : Perform the time shifting, amplitude scaling, folding operationon discrete time signal. Input : %%%%%%%%% exp %%%%%%%%% clc; clearall; closeall; t=15; x=exp(1:5); plot(x); v=shift(x,3,t); f=fold(x); s_f=amp_scaling(x,3); %%%%%%%% fold %%%%%%%%%% function v=fold(x) k=size(x,2); v=[]; fori=k:-1:1; v=[v x(i)]; end end %%%%%%%% shift %%%%%%%%% function v=shift(s,n,t) if n>0 v=[zeros(1,n) s zeros(1,t-abs(n)-size(s,2))]; elseif n<0 v=[s zeros(1,t-size(s,2))]; else v=[s zeros(1,t-size(s,2))]; end end end %%%%%%% amp_scaling %%%%%% function v= amp_scaling(s,scal_factor) v=s*scal_factor
  • 27. ITM UNIVERSE Signal & System 140953109008 Page27 EE A %%%%%% code %%%%% clc; clearall; closeall; t=15; x=exp(1:5); plot(x); v=shift(x,3,t); f=fold(x); s_f=amp_scaling(x,3); figure; subplot(2,2,1);plot(x);xlabel('time');ylabel('amplitude');title('exponatial'); subplot(2,2,2);plot(v);xlabel('time');ylabel('amplitude');title('shifting'); subplot(2,2,3);plot(f);xlabel('time');ylabel('amplitude');title('folding'); subplot(2,2,4);plot(s_f);xlabel('time');ylabel('amplitude');title('scaling'); Output: Conclusion: We Performed the time shifting, amplitude scaling, folding operation on discrete time signal.
  • 28. ITM UNIVERSE Signal & System 140953109008 Page28 EE A LAB. : 5 Generation of Continuous Time Domain Signals Aim 1 : Recording of own voice and displaying its discrete samples Software Required: MATLAB 2013 Input: % Record your voice for 5 seconds. recObj = audiorecorder; disp('Start speaking.') recordblocking(recObj, 5); disp('End of Recording.'); % Play back the recording. play(recObj); % Store data in double-precision array. myRecording = getaudiodata(recObj); % Plot the waveform. plot(myRecording); Output: Voice is recorded for 5 sec and the graph of the voice signal is obtained.
  • 29. ITM UNIVERSE Signal & System 140953109008 Page29 EE A Aim 2 : Recordand save voice file with .wavextension Software Required: MATLAB 2013 Input : clc; %input Fs=8000; ButtonName= questdlg('press start to record your sound',... 'record',... 'START','STOP','START' ); switch ButtonName, case 'START' x=wavrecord(60000,Fs); msgbox('Now you can hear the recorded sound', 'play'); wavplay(10*x,Fs); case 'STOP' errordlg('you dont want to record??? ','???') x=0; end wavwrite(x,Fs,'C:UsersArpit PatelDesktop'); x Output : Voice is recorded by clicking start button and recording is stopped by clicking stop button and then recording is saved in .wav extension. Aim 3 : Reading existing wave file Software Required: MATLAB 2013 Input : %%%%%%%******program 5******%%%%%% %processing of speech signal [x,Fs]=wavread('C:UsersArpit PatelDownloadsMusica');
  • 30. ITM UNIVERSE Signal & System 140953109008 Page30 EE A n=1:length(x); plot(n,x) title('plot of a.wav') xlabel('time') ylabel('amplitude') wavplay(x,Fs) Output : File is read from the destination and wave form is plotted as below. Conclusion: We studied about different MATLAB functions to record sound, play it, save it and plot its waveform of the recorded or saved .wav file.
  • 31. ITM UNIVERSE Signal & System 140953109008 Page31 EE A LAB. : 6 Linearity Aim 1 : Check linearity of the given function Software Required: MATLAB 2013 Input: (a) y1(n)=2x(n)+3 x1=input(' enter input 1'); x2=input(' enter input 2'); a1=input('weight of input 1'); a2=input('weight of input 2'); Y11=2*(a1*x1+a2*x2)+3; Y12=(2*(a1*x1)+3)+(2*(a2*x2)+3); if Y11==Y12 disp('sys is linear '); else disp('sys is non-linear '); end; (b) x1=input(' enter input 1'); x2=input(' enter input 2'); a1=input('weight of input 1'); a2=input('weight of input 2'); Y21=cos((a1*x1)+(a2*x2)); Y22=cos(a1*x1)+cos(a2*x2); if Y21==Y22 disp('sys is linear '); else disp('sys is non-linear '); end;
  • 32. ITM UNIVERSE Signal & System 140953109008 Page32 EE A output: (a) (b) CONCLUSION: We studied about linearity property and check linearity of the function using MATLAB.