SlideShare una empresa de Scribd logo
1 de 32
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.

Más contenido relacionado

La actualidad más candente

Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabTarun Gehlot
 
Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Randa Elanwar
 
MATLAB BASICS
MATLAB BASICSMATLAB BASICS
MATLAB BASICSbutest
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlabaman gupta
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkreddyprasad reddyvari
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to MatlabTariq kanher
 
Matlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - IMatlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - IVijay Kumar Gupta
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlabMohan Raj
 
Matlab Overviiew
Matlab OverviiewMatlab Overviiew
Matlab OverviiewNazim Naeem
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab Arshit Rai
 
Matlab intro
Matlab introMatlab intro
Matlab introfvijayami
 

La actualidad más candente (19)

Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4Introduction to matlab lecture 1 of 4
Introduction to matlab lecture 1 of 4
 
MATLAB BASICS
MATLAB BASICSMATLAB BASICS
MATLAB BASICS
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
Introduction to Matlab
Introduction to MatlabIntroduction to Matlab
Introduction to Matlab
 
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulinkMATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
MATLAB/SIMULINK for Engineering Applications day 2:Introduction to simulink
 
Brief Introduction to Matlab
Brief  Introduction to MatlabBrief  Introduction to Matlab
Brief Introduction to Matlab
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 
Matlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - IMatlab Tutorial for Beginners - I
Matlab Tutorial for Beginners - I
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab
MatlabMatlab
Matlab
 
What is matlab
What is matlabWhat is matlab
What is matlab
 
Matlab 1 level_1
Matlab 1 level_1Matlab 1 level_1
Matlab 1 level_1
 
Matlab Overviiew
Matlab OverviiewMatlab Overviiew
Matlab Overviiew
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
 
Seminar on MATLAB
Seminar on MATLABSeminar on MATLAB
Seminar on MATLAB
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
 
Matlab intro
Matlab introMatlab intro
Matlab intro
 

Similar a KEVIN MERCHANT DOCUMENT

Similar a KEVIN MERCHANT DOCUMENT (20)

DSP Mat Lab
DSP Mat LabDSP Mat Lab
DSP Mat Lab
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
 
Matlab practical ---1.pdf
Matlab practical ---1.pdfMatlab practical ---1.pdf
Matlab practical ---1.pdf
 
EE6711 Power System Simulation Lab manual
EE6711 Power System Simulation Lab manualEE6711 Power System Simulation Lab manual
EE6711 Power System Simulation Lab manual
 
Matlab Manual
Matlab ManualMatlab Manual
Matlab Manual
 
Introduction to Matlab for Engineering Students.pdf
Introduction to Matlab for Engineering Students.pdfIntroduction to Matlab for Engineering Students.pdf
Introduction to Matlab for Engineering Students.pdf
 
Mmc manual
Mmc manualMmc manual
Mmc manual
 
From zero to MATLAB hero: Mastering the basics and beyond
From zero to MATLAB hero: Mastering the basics and beyondFrom zero to MATLAB hero: Mastering the basics and beyond
From zero to MATLAB hero: Mastering the basics and beyond
 
MATLAB guide
MATLAB guideMATLAB guide
MATLAB guide
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
Matlab - Introduction and Basics
Matlab - Introduction and BasicsMatlab - Introduction and Basics
Matlab - Introduction and Basics
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Introduction to Matlab.pdf
Introduction to Matlab.pdfIntroduction to Matlab.pdf
Introduction to Matlab.pdf
 
interfacing matlab with embedded systems
interfacing matlab with embedded systemsinterfacing matlab with embedded systems
interfacing matlab with embedded systems
 
An ntutorial[1]
An ntutorial[1]An ntutorial[1]
An ntutorial[1]
 
A complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projectsA complete introduction on matlab and matlab's projects
A complete introduction on matlab and matlab's projects
 
Signals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 BatchSignals And Systems Lab Manual, R18 Batch
Signals And Systems Lab Manual, R18 Batch
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab tut2
Matlab tut2Matlab tut2
Matlab tut2
 
Matlab anilkumar
Matlab  anilkumarMatlab  anilkumar
Matlab anilkumar
 

Último

Uneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration PresentationUneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration Presentationuneakwhite
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...allensay1
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...lizamodels9
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableSeo
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayNZSG
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdfRenandantas16
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756dollysharma2066
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Dipal Arora
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxpriyanshujha201
 
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...rajveerescorts2022
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...amitlee9823
 
John Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdfJohn Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdfAmzadHosen3
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Sheetaleventcompany
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1kcpayne
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxAndy Lambert
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperityhemanthkumar470700
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Serviceritikaroy0888
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLkapoorjyoti4444
 

Último (20)

Forklift Operations: Safety through Cartoons
Forklift Operations: Safety through CartoonsForklift Operations: Safety through Cartoons
Forklift Operations: Safety through Cartoons
 
Uneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration PresentationUneak White's Personal Brand Exploration Presentation
Uneak White's Personal Brand Exploration Presentation
 
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
Call Girls Service In Old Town Dubai ((0551707352)) Old Town Dubai Call Girl ...
 
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
Call Girls From Pari Chowk Greater Noida ❤️8448577510 ⊹Best Escorts Service I...
 
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service AvailableCall Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
Call Girls Ludhiana Just Call 98765-12871 Top Class Call Girl Service Available
 
It will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 MayIt will be International Nurses' Day on 12 May
It will be International Nurses' Day on 12 May
 
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf0183760ssssssssssssssssssssssssssss00101011 (27).pdf
0183760ssssssssssssssssssssssssssss00101011 (27).pdf
 
Falcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in indiaFalcon Invoice Discounting platform in india
Falcon Invoice Discounting platform in india
 
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
FULL ENJOY Call Girls In Majnu Ka Tilla, Delhi Contact Us 8377877756
 
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
Call Girls Navi Mumbai Just Call 9907093804 Top Class Call Girl Service Avail...
 
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptxB.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
B.COM Unit – 4 ( CORPORATE SOCIAL RESPONSIBILITY ( CSR ).pptx
 
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
👉Chandigarh Call Girls 👉9878799926👉Just Call👉Chandigarh Call Girl In Chandiga...
 
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
Call Girls Kengeri Satellite Town Just Call 👗 7737669865 👗 Top Class Call Gir...
 
John Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdfJohn Halpern sued for sexual assault.pdf
John Halpern sued for sexual assault.pdf
 
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
Chandigarh Escorts Service 📞8868886958📞 Just📲 Call Nihal Chandigarh Call Girl...
 
Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1Katrina Personal Brand Project and portfolio 1
Katrina Personal Brand Project and portfolio 1
 
Monthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptxMonthly Social Media Update April 2024 pptx.pptx
Monthly Social Media Update April 2024 pptx.pptx
 
Falcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to ProsperityFalcon's Invoice Discounting: Your Path to Prosperity
Falcon's Invoice Discounting: Your Path to Prosperity
 
Call Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine ServiceCall Girls In Panjim North Goa 9971646499 Genuine Service
Call Girls In Panjim North Goa 9971646499 Genuine Service
 
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRLBAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
BAGALUR CALL GIRL IN 98274*61493 ❤CALL GIRLS IN ESCORT SERVICE❤CALL GIRL
 

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.