SlideShare uma empresa Scribd logo
1 de 34
01/12/2006 Department of Electrical & Electronics Engineering Introduction to MATLAB
01/12/2006 Department of Electrical & Electronics Engineering Outline ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
01/12/2006 Department of Electrical & Electronics Engineering Welcome to MATLAB ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
01/12/2006 Department of Electrical & Electronics Engineering Getting Started  Command-Window Workspace & Directory Command- History
01/12/2006 Department of Electrical & Electronics Engineering ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
01/12/2006 Department of Electrical & Electronics Engineering Basic MATLAB Commands clear all :  clears  workspace  of all variables close all  : closes all the figure windows plot (x,y)  : plots vector “y” versus “x” % :  used for Comments help :  when used with command gives its syntax
01/12/2006 Department of Electrical & Electronics Engineering Basic Arithmetic Operators  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
01/12/2006 Department of Electrical & Electronics Engineering Variables ,[object Object],[object Object],[object Object],int a; double b; float c; Example: >>x=5; >>x1=2;
01/12/2006 Department of Electrical & Electronics Engineering ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
01/12/2006 Department of Electrical & Electronics Engineering ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Array, Matrix
01/12/2006 Department of Electrical & Electronics Engineering ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Long Array, Matrix
01/12/2006 Department of Electrical & Electronics Engineering Generating Vectors from Functions ,[object Object],[object Object],[object Object],[object Object],x = zeros(1,3) x = 0 0 0 x = ones(1,3) x = 1 1 1 x = rand(1,3) x = 0.9501 0.2311 0.6068
01/12/2006 Department of Electrical & Electronics Engineering Matrix Index ,[object Object],[object Object],Given: A(-2), A(0) Error:  ??? Subscript indices must either be real positive integers or logical.  A(4,2) Error:  ??? Index exceeds matrix dimensions.
01/12/2006 Department of Electrical & Electronics Engineering Concatenation of Matrices  ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],C = [x y ;z]  Error: ??? Error using ==> vertcat CAT arguments dimensions are not consistent.
01/12/2006 Department of Electrical & Electronics Engineering First, let's create a simple vector with 9 elements called  a a = [1 2 3 4 6 4 3 4 5] a = 1 2 3 4 6 4 3 4 5 b = a + 2 b = 3 4 5 6 8 6 5 6 7 Notice how MATLAB requires no special handling of vector or matrix math. Basic matrix operation
01/12/2006 Department of Electrical & Electronics Engineering Creating a matrix Given A and B: Addition Subtraction Product Transpose
01/12/2006 Department of Electrical & Electronics Engineering Operators (Element by Element) .*   element-by-element multiplication ./   element-by-element division .^   element-by-element power
01/12/2006 Department of Electrical & Electronics Engineering The Use of “ .” and “Element Operation” A = [1 2 3; 5 1 4; 3 2 1] A = 1 2 3 5 1 4 3 2 -1 x = A(1,:) x = 1 2 3  y = A(3 ,:) y= 3 4 -1 b = x .* y B=3 8 -3  c = x . / y c= 0.33 0.5 -3  d = x .^2 d= 1 4 9  K= x^2 Erorr:   ??? Error using ==> mpower Matrix must be square. B=x*y Erorr: ??? Error using ==> mtimes Inner matrix dimensions must agree .
01/12/2006 Department of Electrical & Electronics Engineering eye  identity matrix zeros  matrix of zeros ones  matrix of ones diag  create or extract diagonals triu  upper triangular part of a matrix tril  lower triangular part of a matrix Rand  randomly generated matrix hilb  Hilbert matrix magic  magic square Creating Matrices using in-built functions
Basic Task: Plot the function sin(x) between 0≤x≤4π  01/12/2006 Department of Electrical & Electronics Engineering Scalar in-built functions >>x=linspace(0,4*pi,100); >>y=sin(x); >>plot(y)
Plot the function e -x/3 sin(x) between 0≤x≤4π  01/12/2006 Department of Electrical & Electronics Engineering Scalar in-built functions Calculate e -x/3  of the x-array >>y1=exp(-x/3); Multiply the arrays y and y1 >>y2=y*y1; Multiply the arrays y and y1  correctly >>y2=y.*y1; >>plot(y2)
01/12/2006 Department of Electrical & Electronics Engineering Matrix in-built functions eig det size length rank Find  Eigen values and eigenvectors determinant Size of an array Length of a vector rank fi nd indices of nonzero entries x = 2 * rand(1,5) y = x(find(x > 1)) Suppose we want vector that consists all values of x greater than 1
01/12/2006 Department of Electrical & Electronics Engineering plot (x ,y)  plots vector  y  versus vector  x Plotting in Matlab plot(y)  plots the columns of  y  versus their index. plot(x ,y,s ) Where  s  is a character string made from one element from any or all the following 3 columns: b blue . point - solid  g green o circle : dotted r red x x-mark -. dashdot  c cyan + plus -- dashed  Example  : plot(x, y, ‘r+:') plots a red dotted line with a plus at each data point
01/12/2006 Department of Electrical & Electronics Engineering Plotting in Matlab - Examples x = -2.9:0.2:2.9; bar(x, exp(-x.*x)); x = -2.9:0.2:2.9; plot(x, exp(-x.*x));
01/12/2006 Department of Electrical & Electronics Engineering Plotting in Matlab x = -pi:pi/10:pi; y = tan(sin(x)) - sin(tan(x)); plot(x,y,'--rs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','g',... 'MarkerSize',10)
01/12/2006 Department of Electrical & Electronics Engineering x=0:0.25:10; stairs(x, sin(x)); x = 0:0.1:4; y = sin(x.^2).*exp(-x); stem (x,y) Plotting in Matlab - Examples
01/12/2006 Department of Electrical & Electronics Engineering More details of  plot  Plot (X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by the (X,Y,S) triples, x = -pi:pi/10:pi; y = tan(sin(x)) - sin(tan(x)); y1=- sin(tan(x)) plot(x,y,'--rs',x,y1,'ob:')
01/12/2006 Department of Electrical & Electronics Engineering Programming in Matlab-Creating  M-file Click to create a new M-File ,[object Object],[object Object]
01/12/2006 Department of Electrical & Electronics Engineering Flow control in Programming ,[object Object],[object Object],[object Object],[object Object],[object Object]
01/12/2006 Department of Electrical & Electronics Engineering Control structure in Programming ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],Some Dummy Examples if ((a>3) & (b==5)) Some Matlab Commands;  end ----------------------------------- if (a<3) Some Matlab Commands; elseif (b~=5)  Some Matlab Commands; End
01/12/2006 Department of Electrical & Electronics Engineering While Loop Syntax   while (condition) Matlab Commands end Dummy Example while ((a>3) & (b==5)) Some Matlab Commands;  end Control structure
01/12/2006 Department of Electrical & Electronics Engineering ,[object Object],[object Object],[object Object],[object Object],Some Dummy Examples for i=1:100 Some Matlab Commands; end -------------------------------------------- for j=1:3:200 Some Matlab Commands; end ------------------------------------------ for m=13:-0.2:-21 Some Matlab Commands; end  Control structure
01/12/2006 Department of Electrical & Electronics Engineering
01/12/2006 Department of Electrical & Electronics Engineering Writing User defined functions ,[object Object],[object Object],[object Object],function out1=functionname(in1) function out1=functionname(in1,in2,in3) function [out1,out2]=functionname(in1,in2) Note : You should write this command at the beginning of the m-file and you should save the m-file with a file name same as the function name

Mais conteúdo relacionado

Mais procurados

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 projectsMukesh Kumar
 
Matlab-Data types and operators
Matlab-Data types and operatorsMatlab-Data types and operators
Matlab-Data types and operatorsLuckshay Batra
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructuresKrish_ver2
 
Smib pgm
Smib pgmSmib pgm
Smib pgmsannbhu
 
Introduction to MATLAB 1
Introduction to MATLAB 1Introduction to MATLAB 1
Introduction to MATLAB 1Mohamed Gafar
 
Image recogonization
Image recogonizationImage recogonization
Image recogonizationSANTOSH RATH
 
Vision systems_Image processing tool box in MATLAB
Vision systems_Image processing tool box in MATLABVision systems_Image processing tool box in MATLAB
Vision systems_Image processing tool box in MATLABHinna Nayab
 
Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)Memo Love
 
S6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysisS6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysisShaikh Mohsin
 
Forelasning4
Forelasning4Forelasning4
Forelasning4Memo Love
 

Mais procurados (20)

matlab
matlabmatlab
matlab
 
Fourier Transform Assignment Help
Fourier Transform Assignment HelpFourier Transform Assignment Help
Fourier Transform Assignment Help
 
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
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Matlab-Data types and operators
Matlab-Data types and operatorsMatlab-Data types and operators
Matlab-Data types and operators
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
5.4 randomized datastructures
5.4 randomized datastructures5.4 randomized datastructures
5.4 randomized datastructures
 
Smib pgm
Smib pgmSmib pgm
Smib pgm
 
Matlab quick quide3.4
Matlab  quick quide3.4Matlab  quick quide3.4
Matlab quick quide3.4
 
Pca ppt
Pca pptPca ppt
Pca ppt
 
What is matlab
What is matlabWhat is matlab
What is matlab
 
Introduction to MATLAB 1
Introduction to MATLAB 1Introduction to MATLAB 1
Introduction to MATLAB 1
 
Environmental Engineering Assignment Help
Environmental Engineering Assignment HelpEnvironmental Engineering Assignment Help
Environmental Engineering Assignment Help
 
Image recogonization
Image recogonizationImage recogonization
Image recogonization
 
Vision systems_Image processing tool box in MATLAB
Vision systems_Image processing tool box in MATLABVision systems_Image processing tool box in MATLAB
Vision systems_Image processing tool box in MATLAB
 
Introduction to simulink (1)
Introduction to simulink (1)Introduction to simulink (1)
Introduction to simulink (1)
 
working with matrices in r
working with matrices in rworking with matrices in r
working with matrices in r
 
S6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysisS6 l04 analytical and numerical methods of structural analysis
S6 l04 analytical and numerical methods of structural analysis
 
Computation Assignment Help
Computation Assignment Help Computation Assignment Help
Computation Assignment Help
 
Forelasning4
Forelasning4Forelasning4
Forelasning4
 

Destaque

Adaptive control of saturated induction motor with uncertain load torque
Adaptive control of saturated induction motor with uncertain load torqueAdaptive control of saturated induction motor with uncertain load torque
Adaptive control of saturated induction motor with uncertain load torqueAyyarao T S L V
 
Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1Ayyarao T S L V
 
An introduction to FACTS Technology
An introduction to FACTS TechnologyAn introduction to FACTS Technology
An introduction to FACTS TechnologyAyyarao T S L V
 
Objectives of shunt compensation
Objectives of shunt compensationObjectives of shunt compensation
Objectives of shunt compensationAyyarao T S L V
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLABBhavesh Shah
 
Series & shunt compensation and FACTs Devices
Series & shunt compensation and FACTs DevicesSeries & shunt compensation and FACTs Devices
Series & shunt compensation and FACTs Deviceskhemraj298
 

Destaque (9)

Adaptive control of saturated induction motor with uncertain load torque
Adaptive control of saturated induction motor with uncertain load torqueAdaptive control of saturated induction motor with uncertain load torque
Adaptive control of saturated induction motor with uncertain load torque
 
Transformer
TransformerTransformer
Transformer
 
Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1
 
Drives
DrivesDrives
Drives
 
Ballas1
Ballas1Ballas1
Ballas1
 
An introduction to FACTS Technology
An introduction to FACTS TechnologyAn introduction to FACTS Technology
An introduction to FACTS Technology
 
Objectives of shunt compensation
Objectives of shunt compensationObjectives of shunt compensation
Objectives of shunt compensation
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Series & shunt compensation and FACTs Devices
Series & shunt compensation and FACTs DevicesSeries & shunt compensation and FACTs Devices
Series & shunt compensation and FACTs Devices
 

Semelhante a gmrit-cse

Semelhante a gmrit-cse (20)

MATLAB-Introd.ppt
MATLAB-Introd.pptMATLAB-Introd.ppt
MATLAB-Introd.ppt
 
Matlab1
Matlab1Matlab1
Matlab1
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab-1.pptx
Matlab-1.pptxMatlab-1.pptx
Matlab-1.pptx
 
Matlab
MatlabMatlab
Matlab
 
Matlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processingMatlab for beginners, Introduction, signal processing
Matlab for beginners, Introduction, signal processing
 
Matlab-free course by Mohd Esa
Matlab-free course by Mohd EsaMatlab-free course by Mohd Esa
Matlab-free course by Mohd Esa
 
Basic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptxBasic MATLAB-Presentation.pptx
Basic MATLAB-Presentation.pptx
 
Introduction to MATLAB
Introduction to MATLABIntroduction to MATLAB
Introduction to MATLAB
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 
Matlab booklet
Matlab bookletMatlab booklet
Matlab booklet
 
Basics of matlab
Basics of matlabBasics of matlab
Basics of matlab
 
Es272 ch1
Es272 ch1Es272 ch1
Es272 ch1
 
B61301007 matlab documentation
B61301007 matlab documentationB61301007 matlab documentation
B61301007 matlab documentation
 
1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx1.1Introduction to matlab.pptx
1.1Introduction to matlab.pptx
 
Introduction to matlab
Introduction to matlabIntroduction to matlab
Introduction to matlab
 
Matlab
MatlabMatlab
Matlab
 
Introduction to Matlab.pdf
Introduction to Matlab.pdfIntroduction to Matlab.pdf
Introduction to Matlab.pdf
 
Idea for ineractive programming language
Idea for ineractive programming languageIdea for ineractive programming language
Idea for ineractive programming language
 
Matlab introduction
Matlab introductionMatlab introduction
Matlab introduction
 

Mais de Ayyarao T S L V

A Review and Aspects of High Altitude Wind Power Generation
A Review and Aspects of High Altitude Wind Power GenerationA Review and Aspects of High Altitude Wind Power Generation
A Review and Aspects of High Altitude Wind Power GenerationAyyarao T S L V
 
Static shunt compensation
Static shunt compensationStatic shunt compensation
Static shunt compensationAyyarao T S L V
 
Basic types of facts controllers
Basic types of facts controllersBasic types of facts controllers
Basic types of facts controllersAyyarao T S L V
 
An introduction to FACTS
An introduction to FACTSAn introduction to FACTS
An introduction to FACTSAyyarao T S L V
 
Power Flow in a Transmission line
Power Flow in a Transmission linePower Flow in a Transmission line
Power Flow in a Transmission lineAyyarao T S L V
 
Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1Ayyarao T S L V
 

Mais de Ayyarao T S L V (9)

A Review and Aspects of High Altitude Wind Power Generation
A Review and Aspects of High Altitude Wind Power GenerationA Review and Aspects of High Altitude Wind Power Generation
A Review and Aspects of High Altitude Wind Power Generation
 
Static shunt compensation
Static shunt compensationStatic shunt compensation
Static shunt compensation
 
Basic types of facts controllers
Basic types of facts controllersBasic types of facts controllers
Basic types of facts controllers
 
An introduction to FACTS
An introduction to FACTSAn introduction to FACTS
An introduction to FACTS
 
Power Flow in a Transmission line
Power Flow in a Transmission linePower Flow in a Transmission line
Power Flow in a Transmission line
 
Drives
DrivesDrives
Drives
 
Hydrogenerator
HydrogeneratorHydrogenerator
Hydrogenerator
 
INDUCTION MOTOR1
INDUCTION MOTOR1INDUCTION MOTOR1
INDUCTION MOTOR1
 
Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1Matlab Mech Eee Lectures 1
Matlab Mech Eee Lectures 1
 

Último

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024The Digital Insurer
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...apidays
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native ApplicationsWSO2
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsNanddeep Nachan
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MIND CTI
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfOverkill Security
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...apidays
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Angeliki Cooney
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfOverkill Security
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Victor Rentea
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 

Último (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024AXA XL - Insurer Innovation Award Americas 2024
AXA XL - Insurer Innovation Award Americas 2024
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Architecting Cloud Native Applications
Architecting Cloud Native ApplicationsArchitecting Cloud Native Applications
Architecting Cloud Native Applications
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
Cyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdfCyberprint. Dark Pink Apt Group [EN].pdf
Cyberprint. Dark Pink Apt Group [EN].pdf
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 

gmrit-cse

  • 1. 01/12/2006 Department of Electrical & Electronics Engineering Introduction to MATLAB
  • 2.
  • 3.
  • 4. 01/12/2006 Department of Electrical & Electronics Engineering Getting Started Command-Window Workspace & Directory Command- History
  • 5.
  • 6. 01/12/2006 Department of Electrical & Electronics Engineering Basic MATLAB Commands clear all : clears workspace of all variables close all : closes all the figure windows plot (x,y) : plots vector “y” versus “x” % : used for Comments help : when used with command gives its syntax
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15. 01/12/2006 Department of Electrical & Electronics Engineering First, let's create a simple vector with 9 elements called a a = [1 2 3 4 6 4 3 4 5] a = 1 2 3 4 6 4 3 4 5 b = a + 2 b = 3 4 5 6 8 6 5 6 7 Notice how MATLAB requires no special handling of vector or matrix math. Basic matrix operation
  • 16. 01/12/2006 Department of Electrical & Electronics Engineering Creating a matrix Given A and B: Addition Subtraction Product Transpose
  • 17. 01/12/2006 Department of Electrical & Electronics Engineering Operators (Element by Element) .* element-by-element multiplication ./ element-by-element division .^ element-by-element power
  • 18. 01/12/2006 Department of Electrical & Electronics Engineering The Use of “ .” and “Element Operation” A = [1 2 3; 5 1 4; 3 2 1] A = 1 2 3 5 1 4 3 2 -1 x = A(1,:) x = 1 2 3 y = A(3 ,:) y= 3 4 -1 b = x .* y B=3 8 -3 c = x . / y c= 0.33 0.5 -3 d = x .^2 d= 1 4 9 K= x^2 Erorr: ??? Error using ==> mpower Matrix must be square. B=x*y Erorr: ??? Error using ==> mtimes Inner matrix dimensions must agree .
  • 19. 01/12/2006 Department of Electrical & Electronics Engineering eye identity matrix zeros matrix of zeros ones matrix of ones diag create or extract diagonals triu upper triangular part of a matrix tril lower triangular part of a matrix Rand randomly generated matrix hilb Hilbert matrix magic magic square Creating Matrices using in-built functions
  • 20. Basic Task: Plot the function sin(x) between 0≤x≤4π 01/12/2006 Department of Electrical & Electronics Engineering Scalar in-built functions >>x=linspace(0,4*pi,100); >>y=sin(x); >>plot(y)
  • 21. Plot the function e -x/3 sin(x) between 0≤x≤4π 01/12/2006 Department of Electrical & Electronics Engineering Scalar in-built functions Calculate e -x/3 of the x-array >>y1=exp(-x/3); Multiply the arrays y and y1 >>y2=y*y1; Multiply the arrays y and y1 correctly >>y2=y.*y1; >>plot(y2)
  • 22. 01/12/2006 Department of Electrical & Electronics Engineering Matrix in-built functions eig det size length rank Find Eigen values and eigenvectors determinant Size of an array Length of a vector rank fi nd indices of nonzero entries x = 2 * rand(1,5) y = x(find(x > 1)) Suppose we want vector that consists all values of x greater than 1
  • 23. 01/12/2006 Department of Electrical & Electronics Engineering plot (x ,y) plots vector y versus vector x Plotting in Matlab plot(y) plots the columns of y versus their index. plot(x ,y,s ) Where s is a character string made from one element from any or all the following 3 columns: b blue . point - solid g green o circle : dotted r red x x-mark -. dashdot c cyan + plus -- dashed Example : plot(x, y, ‘r+:') plots a red dotted line with a plus at each data point
  • 24. 01/12/2006 Department of Electrical & Electronics Engineering Plotting in Matlab - Examples x = -2.9:0.2:2.9; bar(x, exp(-x.*x)); x = -2.9:0.2:2.9; plot(x, exp(-x.*x));
  • 25. 01/12/2006 Department of Electrical & Electronics Engineering Plotting in Matlab x = -pi:pi/10:pi; y = tan(sin(x)) - sin(tan(x)); plot(x,y,'--rs','LineWidth',2,... 'MarkerEdgeColor','k',... 'MarkerFaceColor','g',... 'MarkerSize',10)
  • 26. 01/12/2006 Department of Electrical & Electronics Engineering x=0:0.25:10; stairs(x, sin(x)); x = 0:0.1:4; y = sin(x.^2).*exp(-x); stem (x,y) Plotting in Matlab - Examples
  • 27. 01/12/2006 Department of Electrical & Electronics Engineering More details of plot Plot (X1,Y1,S1,X2,Y2,S2,X3,Y3,S3,...) combines the plots defined by the (X,Y,S) triples, x = -pi:pi/10:pi; y = tan(sin(x)) - sin(tan(x)); y1=- sin(tan(x)) plot(x,y,'--rs',x,y1,'ob:')
  • 28.
  • 29.
  • 30.
  • 31. 01/12/2006 Department of Electrical & Electronics Engineering While Loop Syntax while (condition) Matlab Commands end Dummy Example while ((a>3) & (b==5)) Some Matlab Commands; end Control structure
  • 32.
  • 33. 01/12/2006 Department of Electrical & Electronics Engineering
  • 34.