SlideShare a Scribd company logo
1 of 26
Download to read offline
      



          SRI SAI INSTITUTE OF ENGG. AND TECHNOLOGY

 




                                                             
                              


                                                                  
              MATLAB PRACTICAL FILE
 




                         DSP
                       ECE - 316
 




                                               Submitted By: 

                                                Abhishek Sharma
                                                ECE - 6th Sem.
TABLE OF CONTENTS 


Contents

Inroduction	To	MATLAB		_____________________________________________________________________	 1	
Program	For	Impulse	Function		_____________________________________________________________	 4	
Program	For	Unit	Step	Function		____________________________________________________________	6	
Program	For	Unit	Ramp	Function		__________________________________________________________	 8	
Program	For	Exponential	Function		______________________________________________________		10	
Program	For	Real	Value	Function		________________________________________________________		16	
Program	For	Shifting	Function		 ___________________________________________________________		14	
                              _
Program	For	Addition	Function	___________________________________________________________		16	
Program	For	Multiplication	Function	____________________________________________________		18	
Program	For	Convolution	Function		______________________________________________________		20	
Program	For	Folding	Function		____________________________________________________________		23
WHAT	IS	MATLAB?	
                      “AN	INTRODUCTION”	
 

    •   It	stands	for	MATrix	LAbORATORY	
    •   It	is	developed	by	The	Mathworks	Inc.	
    •   It	is	an	interactive,	integrated,	environment	
    •   For	numerical	computations	
    •   For	symbolic	computations	
    •   For	scientific	visualizations	
    •   It	is	a	high	level	programming	language	
    •   Program	runs	in	interpreted,	as	opposed	to	compiled,	mode	
    •   MATLAB	 is	 a	 high	 level	 technical	 computing	 language	 and	 interactive	 environment	 for	
        algorithm	development,	 data	 visualization,	data	analysis	 and	 numeric	computation.	 	 Using	
        the	 MATLAB	 product,	 you	 can	 solve	 technical	 computing	 problems	 faster	 than	 the	
        traditional	programming	languages	such	as	C,	C++	and	FORTRAN.	
    •   You	can	use	MATLAB	in	a	wide	range	of	applications,	including	signal	and	image	processing,	
        communication,	control	design,	test	and	measurement,	financial	modeling	and	analysis,	and	
        computational	 biology.	 Add	 on	 toolboxes(collection	 of	 special	 purpose	 MATLAB	 functions,	
        available	 separately)	 extend	 the	 MATLAB	 environment	 to	 solve	 particular	 classes	 of	
        problems	in	these	application	areas.	
    •   MATLAB	 provides	 a	 number	 of	 features	 for	 documenting	 and	 sharing	 your	 work.	 You	 can	
        integrate	 your	 MATLAB	 code	 with	 other	 languages	 and	 applications,	 and	 distribute	 your	
        MATLAB	algorithms	and	applications.	
         

 

 

 

 

 

 

 

        1     
 
Characterstics Of MATLAB:
 

    •   Programming	Language	Based(principally)	On	Matrices.	
    •   Slow	compared	with	FORTRAN	or	C	because	it	is	an	interpreted	language,	i.e	not	pre‐
        compiled.	Avoid	for	loops,	instead	use	vector	form	whenever	possible.	
    •   Automatic	memory	management,	i.e	you	don’t	have	to	declare	arrays	in	advance.	
    •   Intuitive,	easy	to	use.	
    •   Compact	(array	handling	is	Fortran	90‐like).	
    •   Shorter	program	development	time	than	traditional	programming	languages	such	as	
        FORTRAN	and	C.	
    •   Can	be	converted	into	C	code	via	MATLAB	compiler	for	better	efficiency.	
    •   Many	applications‐	specific	toolboxes	available.	
    •   Coupled	with	Maple	for	symbolic	computations.	
    •   On	shared‐memory	parallel	computers	such	as	the	SGI	Origin2000,	certain	operations	
        processed	in	parallel	autonomously	when	computation	load	warrants.	




                                   KEY FEATURES:-
 

    •   High	level	language	for	technical	computing.	
    •   Development	environment	for	managing	code,	files,	and	data.	
    •   Interactive	tools	for	iterative	exploration,	design	and	problem	solving.	
    •   Mathematical	functions	for	linear	algebra,	statistics,	Fourier	analysis,	filtering,	optimization,	
        and	numerical	integration	
    •   2‐D	and	3‐D	graphical	functions	for	visualizing	data.	
    •   Tools	for	building	custom	graphical	user	interfaces.	
    •   Functions	for	integrating	MATLAB	based	algorithm	with	external	application	and	languages,	
        such	as	C,	C++,	FORTRAN,	Java,	and	Microsoft	Excel.	

 

 

 

 

 

        2     
 
EXAMPLES:-
 

    •   Matrix	computation	and	linear	algebra.	
    •   Solving	nonlinear	equation.	
    •   Numerical	solution	of	differential	equation.	
    •   Mathematical	optimization.	
    •   Statistical	and	data	analysis.	
    •   Signal	Processing.	
    •   Modeling	of	dynamical	systems.	
    •   Solving	partial	differential	equation.	
    •   Simulation	of	Engg.	Systems.	
        	


                          USES	IN	ENGG.	COMPANIES:‐	
 

    •   Numerical	analysis	
    •   Signal	and	system.	
    •   Modeling	of	dynamical	systems.	
    •   Automatic	control.	
        	


                                      BASIC	COURSES:‐	
 

    •   Automatic	control	advanced	course.	
    •   Hybrid	and	embedded.	
    •   Control	system.	
    •   Chemical	process	control.	
    •   Control	process	control.	
    •   Signal	theory.	
    •   Digital	signal	processing.	
    •   Adaptive	signal	processing.	
    •   Signal	processing	project.	
    •   Communication	theory.	
    •   Advance	communication	theory.	

 

        3     
 
Program - 1
       To Develop Elementary Signal For Impulse Function 
 


Program:	
 

a=[‐2;1;2] 

b=[zeros(1,2),ones(1,1),zeros(1,2)] 

stem(a,b) 

xlabel(‘a‐‐‐‐>’) 

ylabel(‘amp‐‐‐>’) 

 


                                            	
Result: 
 

a= ‐2   ‐1    0    1    2 

 

b= 0    0    1    0    0 

 

 

 

 

 

 




         4     
 
Graph For Impulse Function: 
 




                                

 

 

 

 

 

 

 

 

 

 




    5     
 
Program - 2
       To Develop Elementary Signal For Unit Step Function 
 


Program: 
 

n=input(’enter the value of n’) 

a=[1:1:n] 

b=[ones,n] 

subplotes 

stem(a,b) 

xlabel(‘n…..>’) 

ylabel(‘amplitude’) 

 

 


Result of unit step function:	
 

Enter the value of n 

n=5 

a=0  1  2  3  4 

b= 1   1   1   1   1 

 

 

                                                                                                         
           
           


        6       
 
Graph For Unit Step Function: 

                            	




                                 	
                            	
                            	
                            	
                            	
																						

       7     
 
Program - 3
 


    To Develop Elementary Signal For Unit Ramp Function 
 


Program:	
 

a=[2:1:8] 

b=[0;1;6] 

subplot 

stem(a,b) 

xlabel(‘n.’) 

ylabel(‘amp….’) 

 

 


Result of unit ramp function:	
 

a=2    3    4    5    6    7    8 

 

b= 0    1    2    3    4    5    6   

 

 

 

 

 

 


         8       
 
Graph For Unit Ramp Function: 




                                                 	
                                             	
                                             	
                                             	
                                             	
                                             	
																																										
      9     
 
Program - 4
    To Develop Exponential Function Of (Given) Sequence 
 


Program:	
 

n=input(‘enter the value of n’) 

a=input(‘enter the value of a’) 

t=[0:1:n] 

y=exp(a*t) 

subplot 

stem(t,y) 

xlabel(‘a’) 

ylabel(‘n’) 

 


Result of exponential: 
Enter the value of n10 

n= 10 

enter the value of a0.5 

a= 0.5000 

t=0   1   2   3   4   5   6   7   8   9   10 

y=columns 1 through 10 

1.0000  1.6487  2.7183  4.4817  7.3891  12.1825  20.0855  33.1155  54.5982  90.0171 

Column11 

148.4132 



      10        
 
Graph For Exponential Function: 




                                                       	
                                                   	
                                                   	
                                                   	
                                                   	
                                                   	
																																																
     11     
 
Program - 5
                   To Develop Elementary Signal For Real Value 
 


Program: 
 

n=[0,1,2,3,4,5] 

a=[0.5] 

y=a.^n 

subplot 

stem(n,y) 

xlabel(‘n…..’) 

ylabel(‘a’) 

 


Result of Real Value No.:	
 

n= 0   1   2   3   4   5   

 

a= 0.5000 

 

y = 1.0000   0.5000   0.2500   0.1250   0.0625   0.0313 

 

 




      12        
 
Graph For Real Value Function:	




                                           	
                                       	
                                       	
                                       	
                                       	
                                       	
																																				

     13     
 
Program - 6
        To Develop Elementary Signal For Shifting Program: 
 

a=[‐3:1:3] 

b=[1.2.3.2.1.1.2] 

subplot(3,1,1) 

stem(a,b) 

xlabel(‘n‐‐‐‐>’) 

ylabel(‘amp‐‐‐>’) 

a=‐a 

subplot(3,1,2) 

stem(a,b) 

xlabel(‘n‐‐‐‐>’) 

ylabel(‘amp‐‐‐>’) 

 


Result: 
 

a = ‐3   ‐2   ‐1   0   1   2   3 

b = 1   2   3   2   1   1   2 

a = 3   2   1   0   ‐1   ‐2   ‐3 

 

 




        14     
 
 

Graph For Shifting Function: 
 

 




                                 

 

 

 

 

 

 

 

 

 


    15     
 
 


                                           Program - 7
        To Develop Elementary Signal For Addition Of Two 
                          Sequences 
 


Program: 
 

n=[‐3:1:3] 
b=[2,3,0,1,3,2,1] 
subplot(5,1,1) 
stem(n,b) 
xlabel('n….>')    
ylabel('amplitude') 
title('input of signal b') 
a=[3,4,5,6,7,8,9] 
subplot(5,1,3) 
stem(n,b) 
ylabel('amplitude') 
title('input of signal a') 
z=b+a 
subplot(5,1,5) 
stem(n,a) 
xlabel('n….>')    
ylabel('amplitude') 
title('addition of two signal is z(n)') 



Result of Addition: 
 

2   3   0   1   3   2   1 

 

a = 3   4   5   6   7   8   9 

 

z = 5   7   5   7   10   10   10 

      16       
 
Graph For Addition Function:	
 




                                                                                      

                                                                                  

 

 

 

 

 

 




         17          
 
Program - 8
    To Develop Elementary Signal For Multiplication Of Two 
                        Sequences 
 


Program:	
 

n=[‐2:1:3] 
x=[1,2,3,4,5,6] 
subplot(3,1,1) 
stem(n,x) 
xlabel('n‐‐‐‐>') 
ylabel('amp‐‐‐>') 
y=[2] 
z=(x*y) 
subplot(3,1,2) 
stem(n,z) 
xlabel('n‐‐‐‐>') 
ylabel('amp‐‐‐>') 



Result: 
 

n = ‐2   ‐1   0   1   2   3 

x = 1   2   3   4   5   6 

y = 2 

z = 2   4   6   8   10   12 




      18       
 
Graph For Multiplication Function: 




                                              	
                                          	
                                          	
                                          	
                                          	
                                          	
                                          	
                                          	
																																							
     19     
 
Program - 9
    To Develop The Elementary Signal For Convolution Of 
                      Two Sequences 
 


Program: 
 

X=input(‘enter the value of x’) 

h=input(‘enter the value of h’) 

y=conv(x,h) 

subplot(3,1,1) 

stem(x) 

xlabel(‘n….>’)    

ylabel(‘amplitude….>’) 

subplot(3,1,2) 

stem(h) 

xlabel(‘n….>’)    

ylabel(‘amplitude….>’) 

subplot(3,1,3) 

stem(y) 

xlabel(‘n….>’)    

ylabel(‘amplitude….>’) 


	
 




     20      
 
Result of convolution: 
 

Enter the sequence of x[1,2] 

X=1   2 

Enter the sequence of h[1,2,3,4]  

h = 1   2   3   4 

y = 1   4   7   10   8 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

      21       
 
Graph For Convolution Function: 
 




                                    

 

 

 

 

 

 

 

 

 




    22     
 
Program - 10
                    To Develop Elementary Signal For Folding 
 


Program:	
 

a=[‐3:1:3] 

b=[1,2,3,2,1,1,2] 

subplot(3,1,1) 

stem(a,b) 

xlabel(‘n….. >’) 

ylabel(‘amp…..>’) 

a= ‐a 

subplot(3,1,2) 

stem(a,b) 

xlabel(‘n…..>’) 

ylabel(‘amp…..>’) 

 


Result of Folding:	
 

a= ‐3   ‐2   ‐1   0    1    2    3 

b=  1    2    3    2    1    1     2 

a=  3    2    1    0   ‐1   ‐2   ‐3  

 

 



      23        
 
Graph For Folding Function: 
 




 

 

 

 

 

 

 

 

 

 

 

 

    24     
 

More Related Content

What's hot

Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systemsKranthi Kumar
 
Variable scope ppt in vb6
Variable scope ppt in vb6Variable scope ppt in vb6
Variable scope ppt in vb6AmanHooda4
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)PyData
 
Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)SHAMJITH KM
 
JavaFX fundamentals
JavaFX fundamentalsJavaFX fundamentals
JavaFX fundamentalsFulvio Corno
 
7. Data Import – Data Export
7. Data Import – Data Export7. Data Import – Data Export
7. Data Import – Data ExportFAO
 
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...Overview and Walkthrough of the Application Programming Model with SAP Cloud ...
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...SAP Cloud Platform
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphicsgrahamwell
 

What's hot (12)

python and database
python and databasepython and database
python and database
 
Enhancement framework the new way to enhance your abap systems
Enhancement framework   the new way to enhance your abap systemsEnhancement framework   the new way to enhance your abap systems
Enhancement framework the new way to enhance your abap systems
 
Variable scope ppt in vb6
Variable scope ppt in vb6Variable scope ppt in vb6
Variable scope ppt in vb6
 
Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)Introduction to NumPy (PyData SV 2013)
Introduction to NumPy (PyData SV 2013)
 
Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)Python programs - PPT file (Polytechnics)
Python programs - PPT file (Polytechnics)
 
JavaFX fundamentals
JavaFX fundamentalsJavaFX fundamentals
JavaFX fundamentals
 
Email Validation
Email ValidationEmail Validation
Email Validation
 
7. Data Import – Data Export
7. Data Import – Data Export7. Data Import – Data Export
7. Data Import – Data Export
 
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...Overview and Walkthrough of the Application Programming Model with SAP Cloud ...
Overview and Walkthrough of the Application Programming Model with SAP Cloud ...
 
Introduction to Mysql
Introduction to MysqlIntroduction to Mysql
Introduction to Mysql
 
Turtle graphics
Turtle graphicsTurtle graphics
Turtle graphics
 
Java Queue.pptx
Java Queue.pptxJava Queue.pptx
Java Queue.pptx
 

Similar to MATLAB Programs For Beginners. | Abhi Sharma

Kevin merchantss
Kevin merchantssKevin merchantss
Kevin merchantssdharmesh69
 
KEVIN MERCHANT DOCUMENT
KEVIN MERCHANT DOCUMENTKEVIN MERCHANT DOCUMENT
KEVIN MERCHANT DOCUMENTtejas1235
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab Arshit Rai
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introductionideas2ignite
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab Arshit Rai
 
R4ML: An R Based Scalable Machine Learning Framework
R4ML: An R Based Scalable Machine Learning FrameworkR4ML: An R Based Scalable Machine Learning Framework
R4ML: An R Based Scalable Machine Learning FrameworkAlok Singh
 
DSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdfDSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdfParthDoshi66
 
DSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docxDSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docxParthDoshi66
 
Mat lab workshop
Mat lab workshopMat lab workshop
Mat lab workshopVinay Kumar
 
Control system Lab record
Control system Lab record Control system Lab record
Control system Lab record Yuvraj Singh
 
On Implementation of Neuron Network(Back-propagation)
On Implementation of Neuron Network(Back-propagation)On Implementation of Neuron Network(Back-propagation)
On Implementation of Neuron Network(Back-propagation)Yu Liu
 

Similar to MATLAB Programs For Beginners. | Abhi Sharma (20)

DSP Mat Lab
DSP Mat LabDSP Mat Lab
DSP Mat Lab
 
Kevin merchantss
Kevin merchantssKevin merchantss
Kevin merchantss
 
KEVIN MERCHANT DOCUMENT
KEVIN MERCHANT DOCUMENTKEVIN MERCHANT DOCUMENT
KEVIN MERCHANT DOCUMENT
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
 
Cse 7 softcomputing lab
Cse 7 softcomputing labCse 7 softcomputing lab
Cse 7 softcomputing lab
 
Matlab Introduction
Matlab IntroductionMatlab Introduction
Matlab Introduction
 
Summer training matlab
Summer training matlab Summer training matlab
Summer training matlab
 
Dsp file
Dsp fileDsp file
Dsp file
 
Dsp file
Dsp fileDsp file
Dsp file
 
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORYGE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
GE3171-PROBLEM SOLVING AND PYTHON PROGRAMMING LABORATORY
 
Lecture 1.pptx
Lecture 1.pptxLecture 1.pptx
Lecture 1.pptx
 
Simulation lab
Simulation labSimulation lab
Simulation lab
 
R4ML: An R Based Scalable Machine Learning Framework
R4ML: An R Based Scalable Machine Learning FrameworkR4ML: An R Based Scalable Machine Learning Framework
R4ML: An R Based Scalable Machine Learning Framework
 
Matlab demo
Matlab demoMatlab demo
Matlab demo
 
Mechanical Engineering Homework Help
Mechanical Engineering Homework HelpMechanical Engineering Homework Help
Mechanical Engineering Homework Help
 
DSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdfDSP_Lab_MAnual_-_Final_Edition.pdf
DSP_Lab_MAnual_-_Final_Edition.pdf
 
DSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docxDSP_Lab_MAnual_-_Final_Edition[1].docx
DSP_Lab_MAnual_-_Final_Edition[1].docx
 
Mat lab workshop
Mat lab workshopMat lab workshop
Mat lab workshop
 
Control system Lab record
Control system Lab record Control system Lab record
Control system Lab record
 
On Implementation of Neuron Network(Back-propagation)
On Implementation of Neuron Network(Back-propagation)On Implementation of Neuron Network(Back-propagation)
On Implementation of Neuron Network(Back-propagation)
 

More from Abee Sharma

GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.
GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.
GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.Abee Sharma
 
Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )
Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )
Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )Abee Sharma
 
If Companies Had Realistic Slogans (Yes They Are Fake!)
If Companies Had Realistic Slogans (Yes They Are Fake!)If Companies Had Realistic Slogans (Yes They Are Fake!)
If Companies Had Realistic Slogans (Yes They Are Fake!)Abee Sharma
 
Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.
Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.
Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.Abee Sharma
 
FDI in Multi-brand Retail (Issues and Challenges)
FDI in Multi-brand Retail (Issues and Challenges)FDI in Multi-brand Retail (Issues and Challenges)
FDI in Multi-brand Retail (Issues and Challenges)Abee Sharma
 
The Great Book Of Best Quotes Of All Time By Abhi Sharma
  The Great Book Of Best Quotes Of All Time By Abhi Sharma  The Great Book Of Best Quotes Of All Time By Abhi Sharma
The Great Book Of Best Quotes Of All Time By Abhi SharmaAbee Sharma
 
Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).Abee Sharma
 
Wireless Radio Frequency Module Using PIC Microcontroller.
Wireless Radio Frequency Module Using PIC Microcontroller.Wireless Radio Frequency Module Using PIC Microcontroller.
Wireless Radio Frequency Module Using PIC Microcontroller.Abee Sharma
 
Crime and Punishment Cover Trouble..??
Crime and Punishment Cover Trouble..??Crime and Punishment Cover Trouble..??
Crime and Punishment Cover Trouble..??Abee Sharma
 

More from Abee Sharma (9)

GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.
GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.
GSM Based Versatile Robotic Vehicle Using PIC Microcontroller Report.
 
Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )
Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )
Comparative Analysis Of Coca Cola & Pepsi 2013 (Financial Ratio Analysis )
 
If Companies Had Realistic Slogans (Yes They Are Fake!)
If Companies Had Realistic Slogans (Yes They Are Fake!)If Companies Had Realistic Slogans (Yes They Are Fake!)
If Companies Had Realistic Slogans (Yes They Are Fake!)
 
Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.
Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.
Dying Vet's "Fuck You" Letter To George Bush & Dick Cheney.
 
FDI in Multi-brand Retail (Issues and Challenges)
FDI in Multi-brand Retail (Issues and Challenges)FDI in Multi-brand Retail (Issues and Challenges)
FDI in Multi-brand Retail (Issues and Challenges)
 
The Great Book Of Best Quotes Of All Time By Abhi Sharma
  The Great Book Of Best Quotes Of All Time By Abhi Sharma  The Great Book Of Best Quotes Of All Time By Abhi Sharma
The Great Book Of Best Quotes Of All Time By Abhi Sharma
 
Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).Wireless RF Module Using PIC MCU (Slides).
Wireless RF Module Using PIC MCU (Slides).
 
Wireless Radio Frequency Module Using PIC Microcontroller.
Wireless Radio Frequency Module Using PIC Microcontroller.Wireless Radio Frequency Module Using PIC Microcontroller.
Wireless Radio Frequency Module Using PIC Microcontroller.
 
Crime and Punishment Cover Trouble..??
Crime and Punishment Cover Trouble..??Crime and Punishment Cover Trouble..??
Crime and Punishment Cover Trouble..??
 

Recently uploaded

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationMichael W. Hawkins
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreternaman860154
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024Results
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptxHampshireHUG
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsJoaquim Jorge
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdfhans926745
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024Rafal Los
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 

Recently uploaded (20)

08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
GenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day PresentationGenCyber Cyber Security Day Presentation
GenCyber Cyber Security Day Presentation
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Presentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreterPresentation on how to chat with PDF using ChatGPT code interpreter
Presentation on how to chat with PDF using ChatGPT code interpreter
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
Artificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and MythsArtificial Intelligence: Facts and Myths
Artificial Intelligence: Facts and Myths
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf[2024]Digital Global Overview Report 2024 Meltwater.pdf
[2024]Digital Global Overview Report 2024 Meltwater.pdf
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 

MATLAB Programs For Beginners. | Abhi Sharma

  • 1.        SRI SAI INSTITUTE OF ENGG. AND TECHNOLOGY                   MATLAB PRACTICAL FILE   DSP ECE - 316   Submitted By:  Abhishek Sharma ECE - 6th Sem.
  • 2. TABLE OF CONTENTS  Contents Inroduction To MATLAB _____________________________________________________________________ 1 Program For Impulse Function _____________________________________________________________ 4 Program For Unit Step Function ____________________________________________________________ 6 Program For Unit Ramp Function __________________________________________________________ 8 Program For Exponential Function ______________________________________________________ 10 Program For Real Value Function ________________________________________________________ 16 Program For Shifting Function ___________________________________________________________ 14 _ Program For Addition Function ___________________________________________________________ 16 Program For Multiplication Function ____________________________________________________ 18 Program For Convolution Function ______________________________________________________ 20 Program For Folding Function ____________________________________________________________ 23
  • 3. WHAT IS MATLAB? “AN INTRODUCTION”   • It stands for MATrix LAbORATORY • It is developed by The Mathworks Inc. • It is an interactive, integrated, environment • For numerical computations • For symbolic computations • For scientific visualizations • It is a high level programming language • Program runs in interpreted, as opposed to compiled, mode • MATLAB is a high level technical computing language and interactive environment for algorithm development, data visualization, data analysis and numeric computation. Using the MATLAB product, you can solve technical computing problems faster than the traditional programming languages such as C, C++ and FORTRAN. • You can use MATLAB in a wide range of applications, including signal and image processing, communication, control design, test and measurement, financial modeling and analysis, and computational biology. Add on toolboxes(collection of special purpose MATLAB functions, available separately) extend the MATLAB environment to solve particular classes of problems in these application areas. • MATLAB provides a number of features for documenting and sharing your work. You can integrate your MATLAB code with other languages and applications, and distribute your MATLAB algorithms and applications.                 1     
  • 4. Characterstics Of MATLAB:   • Programming Language Based(principally) On Matrices. • Slow compared with FORTRAN or C because it is an interpreted language, i.e not pre‐ compiled. Avoid for loops, instead use vector form whenever possible. • Automatic memory management, i.e you don’t have to declare arrays in advance. • Intuitive, easy to use. • Compact (array handling is Fortran 90‐like). • Shorter program development time than traditional programming languages such as FORTRAN and C. • Can be converted into C code via MATLAB compiler for better efficiency. • Many applications‐ specific toolboxes available. • Coupled with Maple for symbolic computations. • On shared‐memory parallel computers such as the SGI Origin2000, certain operations processed in parallel autonomously when computation load warrants. KEY FEATURES:-   • High level language for technical computing. • Development environment for managing code, files, and data. • Interactive tools for iterative exploration, design and problem solving. • Mathematical functions for linear algebra, statistics, Fourier analysis, filtering, optimization, and numerical integration • 2‐D and 3‐D graphical functions for visualizing data. • Tools for building custom graphical user interfaces. • Functions for integrating MATLAB based algorithm with external application and languages, such as C, C++, FORTRAN, Java, and Microsoft Excel.           2     
  • 5. EXAMPLES:-   • Matrix computation and linear algebra. • Solving nonlinear equation. • Numerical solution of differential equation. • Mathematical optimization. • Statistical and data analysis. • Signal Processing. • Modeling of dynamical systems. • Solving partial differential equation. • Simulation of Engg. Systems. USES IN ENGG. COMPANIES:‐   • Numerical analysis • Signal and system. • Modeling of dynamical systems. • Automatic control. BASIC COURSES:‐   • Automatic control advanced course. • Hybrid and embedded. • Control system. • Chemical process control. • Control process control. • Signal theory. • Digital signal processing. • Adaptive signal processing. • Signal processing project. • Communication theory. • Advance communication theory.   3     
  • 6. Program - 1 To Develop Elementary Signal For Impulse Function    Program:   a=[‐2;1;2]  b=[zeros(1,2),ones(1,1),zeros(1,2)]  stem(a,b)  xlabel(‘a‐‐‐‐>’)  ylabel(‘amp‐‐‐>’)    Result:    a= ‐2   ‐1    0    1    2    b= 0    0    1    0    0              4     
  • 7. Graph For Impulse Function:                          5     
  • 8. Program - 2 To Develop Elementary Signal For Unit Step Function    Program:    n=input(’enter the value of n’)  a=[1:1:n]  b=[ones,n]  subplotes  stem(a,b)  xlabel(‘n…..>’)  ylabel(‘amplitude’)      Result of unit step function:   Enter the value of n  n=5  a=0  1  2  3  4  b= 1   1   1   1   1                                                                                                          6     
  • 10. Program - 3   To Develop Elementary Signal For Unit Ramp Function    Program:   a=[2:1:8]  b=[0;1;6]  subplot  stem(a,b)  xlabel(‘n.’)  ylabel(‘amp….’)      Result of unit ramp function:   a=2    3    4    5    6    7    8    b= 0    1    2    3    4    5    6                8     
  • 12. Program - 4 To Develop Exponential Function Of (Given) Sequence    Program:   n=input(‘enter the value of n’)  a=input(‘enter the value of a’)  t=[0:1:n]  y=exp(a*t)  subplot  stem(t,y)  xlabel(‘a’)  ylabel(‘n’)    Result of exponential:  Enter the value of n10  n= 10  enter the value of a0.5  a= 0.5000  t=0   1   2   3   4   5   6   7   8   9   10  y=columns 1 through 10  1.0000  1.6487  2.7183  4.4817  7.3891  12.1825  20.0855  33.1155  54.5982  90.0171  Column11  148.4132  10     
  • 14. Program - 5 To Develop Elementary Signal For Real Value    Program:    n=[0,1,2,3,4,5]  a=[0.5]  y=a.^n  subplot  stem(n,y)  xlabel(‘n…..’)  ylabel(‘a’)    Result of Real Value No.:   n= 0   1   2   3   4   5      a= 0.5000    y = 1.0000   0.5000   0.2500   0.1250   0.0625   0.0313      12     
  • 16. Program - 6 To Develop Elementary Signal For Shifting Program:    a=[‐3:1:3]  b=[1.2.3.2.1.1.2]  subplot(3,1,1)  stem(a,b)  xlabel(‘n‐‐‐‐>’)  ylabel(‘amp‐‐‐>’)  a=‐a  subplot(3,1,2)  stem(a,b)  xlabel(‘n‐‐‐‐>’)  ylabel(‘amp‐‐‐>’)    Result:    a = ‐3   ‐2   ‐1   0   1   2   3  b = 1   2   3   2   1   1   2  a = 3   2   1   0   ‐1   ‐2   ‐3      14     
  • 17.   Graph For Shifting Function:                          15     
  • 18.   Program - 7 To Develop Elementary Signal For Addition Of Two  Sequences    Program:    n=[‐3:1:3]  b=[2,3,0,1,3,2,1]  subplot(5,1,1)  stem(n,b)  xlabel('n….>')     ylabel('amplitude')  title('input of signal b')  a=[3,4,5,6,7,8,9]  subplot(5,1,3)  stem(n,b)  ylabel('amplitude')  title('input of signal a')  z=b+a  subplot(5,1,5)  stem(n,a)  xlabel('n….>')     ylabel('amplitude')  title('addition of two signal is z(n)')  Result of Addition:    2   3   0   1   3   2   1    a = 3   4   5   6   7   8   9    z = 5   7   5   7   10   10   10  16     
  • 19. Graph For Addition Function:                                                                                                    17     
  • 20. Program - 8 To Develop Elementary Signal For Multiplication Of Two  Sequences    Program:   n=[‐2:1:3]  x=[1,2,3,4,5,6]  subplot(3,1,1)  stem(n,x)  xlabel('n‐‐‐‐>')  ylabel('amp‐‐‐>')  y=[2]  z=(x*y)  subplot(3,1,2)  stem(n,z)  xlabel('n‐‐‐‐>')  ylabel('amp‐‐‐>')  Result:    n = ‐2   ‐1   0   1   2   3  x = 1   2   3   4   5   6  y = 2  z = 2   4   6   8   10   12  18     
  • 22. Program - 9 To Develop The Elementary Signal For Convolution Of  Two Sequences    Program:    X=input(‘enter the value of x’)  h=input(‘enter the value of h’)  y=conv(x,h)  subplot(3,1,1)  stem(x)  xlabel(‘n….>’)     ylabel(‘amplitude….>’)  subplot(3,1,2)  stem(h)  xlabel(‘n….>’)     ylabel(‘amplitude….>’)  subplot(3,1,3)  stem(y)  xlabel(‘n….>’)     ylabel(‘amplitude….>’)    20     
  • 24. Graph For Convolution Function:                        22     
  • 25. Program - 10 To Develop Elementary Signal For Folding    Program:   a=[‐3:1:3]  b=[1,2,3,2,1,1,2]  subplot(3,1,1)  stem(a,b)  xlabel(‘n….. >’)  ylabel(‘amp…..>’)  a= ‐a  subplot(3,1,2)  stem(a,b)  xlabel(‘n…..>’)  ylabel(‘amp…..>’)    Result of Folding:   a= ‐3   ‐2   ‐1   0    1    2    3  b=  1    2    3    2    1    1     2  a=  3    2    1    0   ‐1   ‐2   ‐3       23