SlideShare a Scribd company logo
1 of 16
Download to read offline
•
MATLAB ASHOK(191890)
PRACTICAL-1
Practical-1: Introduction to MATLAB.
Theory:
. MATLAB is a programming language developed by MathWorks. It started out as a matrix programming language
where linear algebra programming was simple. It can be run both under interactive sessions and as a batch job.
.MATLAB (matrix laboratory) is a fourth-generation high-level programming language and interactive environment
for numerical computation, visualization and programming.
. It allows matrix manipulations; plotting of functions and data; implementation of algorithms; creation of user
interfaces; interfacing with programs written in other languages, including C, C++, Java, and FORTRAN; analyze
data; develop algorithms; and create models and applications.
. It has numerous built-in commands and math functions that help you in mathematical calculations, generating
plots, and performing numerical methods.
Uses of MATLAB:
MATLAB is widely used as a computational tool in science and engineering encompassing the fields of physics,
chemistry, math and all engineering streams. It is used in a range of applications including –
. Signal Processing and Communications
. Image and Video Processing
. Control Systems
. Test and Measurement
. Computational Finance .
Computational Biology
MATLAB Environment:
. Command Window
. Command History
. Workspace .
Current Directory
. Edit Window .
Figure Window
Command Window:
MATLAB ASHOK(191890)
Whenever MATLAB is invoked, the main window called command window is activated. The command window
displays the command prompt’>>’ and a cursor where commands are entered and are executed instantaneously.
Command History:
Command history window consists of a list of all the commands that are entered at the command window. These
commands remain in the list until they are deleted. Any command may be executed by selecting and double clicking
it with the mouse.
Workspace:
A workspace is a collection of all the variables that have been generated so far in the current MATLAB session and
shows their data type and size. All the commands executed from Command Window and all the script files executed
from the Command Window share common workspace, so they can share all the variables.
MATLAB ASHOK(191890)
Current Directory:
The Current Directory window contains all the files and folders present in the Current Directory. To run any file, it
must either be in the Current Directory or on the search path.
Edit Window:
An Edit Window is used to create a new program file, or to modify existing files. In this window, programs can be
written, edited and saved. The programs written using the MATLAB editor are automatically assigned an extension
(.m) by the editor and are known as M- files.
Figure Window:
A Figure Window is a separate window with default white background and is used to display MATLAB graphics.
The results of all the graphic commands executed are displayed in the figure window.
MATLAB ASHOK(191890)
Introduction:
a) Making variables :----------------------
a = 2; it's a number
a = '2'; it's a string
a = [1 2 3 4 5]: it's a vector(array) (in JAVA: int array[] = new int[5])
a = [ 1 2; 3 4] it's a matrix (in JAVA: int array[][] = new int[2][2])
a = {'a',2;'b',3} it's a cell (in JAVA structure)
MATLAB ASHOK(191890)
Sqrt()
MATLAB ASHOK(191890)
• Magic(): create square matrix n*n
• Transpose():transpose of the matrix
• Flipup():flip the matrix up and down
• Filplr():flip the matrix left to right
MATLAB ASHOK(191890)
• Inv(): inverse of the matrix
• a.^2 : square of matrix
• eye() : identity matrix
• rand(): create a matrix from random number
MATLAB ASHOK(191890)
C) Basic plot 1) 2-D plot 2) 3-D plot
Syntax
• plot(X,Y)
• plot(X,Y,LineSpec) ---creates the plot using the specified line style, marker, and color.
• plot(X1,Y1,...,Xn,Yn)-- plots multiple pairs of x- and y-coordinates on the same set of axe
•
MATLAB ASHOK(191890)
• plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)-- assigns specific line styles, markers, and colors to each x-y
pair.
• plot(Y)-- plots Y against an implicit set of x-coordinates
•
MATLAB ASHOK(191890)
• plot(Y,LineSpec)--- plots Y using implicit x-coordinates, and specifies the line style, marker, and color.
• plot(tbl,xvar,yvar)--- plots the variables xvar and yvar from the table tbl.
• plot(tbl,yvar)--- plots the specified variable from the table against the row indices of the table.
•
MATLAB ASHOK(191890)
• plot(ax,___)--- displays the plot in the target axes. Specify the axes as the first argument in any of the previous
syntaxes.
• plot(___,Name,Value)-- specifies Line properties using one or more name-value arguments.
•
MATLAB ASHOK(191890)
• p = plot(___)--- returns a Line object or an array of Line objects.
•
MATLAB ASHOK(191890)
3-D Plot
3-D point or line plot
• plot3(X,Y,Z)
• plot3(X,Y,Z,LineSpec)
• plot3(X1,Y1,Z1,...,Xn,Yn,Zn)
•
MATLAB ASHOK(191890)
• plot3(X1,Y1,Z1,LineSpec1,...,Xn,Yn,Zn,LineSpecn)
• plot3(tbl,xvar,yvar,zvar)
•
MATLAB ASHOK(191890)
• plot3(ax,___)
• plot3(___,Name,Value)

More Related Content

Similar to Matlab practical ---1.pdf (20)

DSP Mat Lab
DSP Mat LabDSP Mat Lab
DSP Mat Lab
 
EE6711 Power System Simulation Lab manual
EE6711 Power System Simulation Lab manualEE6711 Power System Simulation Lab manual
EE6711 Power System Simulation Lab 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
 
MATLAB guide
MATLAB guideMATLAB guide
MATLAB guide
 
MATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.pptMATLAB workshop lecture 1MATLAB work.ppt
MATLAB workshop lecture 1MATLAB work.ppt
 
Mmc manual
Mmc manualMmc manual
Mmc manual
 
Matlab tut2
Matlab tut2Matlab tut2
Matlab tut2
 
MATLAB Programming
MATLAB Programming MATLAB Programming
MATLAB Programming
 
Matlab workshop
Matlab workshopMatlab workshop
Matlab workshop
 
Matlab summary
Matlab summaryMatlab summary
Matlab summary
 
Summer training introduction to matlab
Summer training  introduction to matlabSummer training  introduction to matlab
Summer training introduction to matlab
 
Introduction to Matlab.ppt
Introduction to Matlab.pptIntroduction to Matlab.ppt
Introduction to Matlab.ppt
 
Matlab basic and image
Matlab basic and imageMatlab basic and image
Matlab basic and image
 
Matlab lecture
Matlab lectureMatlab lecture
Matlab lecture
 
Matlab anilkumar
Matlab  anilkumarMatlab  anilkumar
Matlab anilkumar
 
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptxMATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
MATLAB Workshop yugjjnhhasfhlhhlllhl.pptx
 
matlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsxmatlab-130408153714-phpapp02_lab123.ppsx
matlab-130408153714-phpapp02_lab123.ppsx
 
Seminar on MATLAB
Seminar on MATLABSeminar on MATLAB
Seminar on MATLAB
 
Matlab
MatlabMatlab
Matlab
 
Matlab Manual
Matlab ManualMatlab Manual
Matlab Manual
 

More from Central university of Haryana

MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdfMATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdfCentral university of Haryana
 

More from Central university of Haryana (20)

Practical --2..pdf
Practical --2..pdfPractical --2..pdf
Practical --2..pdf
 
Practical --1.pdf
Practical --1.pdfPractical --1.pdf
Practical --1.pdf
 
ML Lab.docx
ML Lab.docxML Lab.docx
ML Lab.docx
 
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdfMATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
MATLAB-Cheat-Sheet-for-Data-Science_LondonSchoolofEconomics (1).pdf
 
LittleBookOfRuby.pdf
LittleBookOfRuby.pdfLittleBookOfRuby.pdf
LittleBookOfRuby.pdf
 
all matlab_prog.pdf
all              matlab_prog.pdfall              matlab_prog.pdf
all matlab_prog.pdf
 
Practical13.docx
Practical13.docxPractical13.docx
Practical13.docx
 
Practical 111.docx
Practical 111.docxPractical 111.docx
Practical 111.docx
 
Matlab Practical--11.pdf
Matlab Practical--11.pdfMatlab Practical--11.pdf
Matlab Practical--11.pdf
 
Matlab Practical--11.docx
Matlab Practical--11.docxMatlab Practical--11.docx
Matlab Practical--11.docx
 
Matlab Practical--9.docx
Matlab Practical--9.docxMatlab Practical--9.docx
Matlab Practical--9.docx
 
Matlab Practical-- 12.pdf
Matlab Practical-- 12.pdfMatlab Practical-- 12.pdf
Matlab Practical-- 12.pdf
 
Matlab practical ---9.pdf
Matlab practical ---9.pdfMatlab practical ---9.pdf
Matlab practical ---9.pdf
 
Matlab practical ---7.pdf
Matlab practical ---7.pdfMatlab practical ---7.pdf
Matlab practical ---7.pdf
 
Matlab practical ---6.pdf
Matlab practical ---6.pdfMatlab practical ---6.pdf
Matlab practical ---6.pdf
 
Matlab practical ---5.pdf
Matlab practical ---5.pdfMatlab practical ---5.pdf
Matlab practical ---5.pdf
 
Matlab practical ---4.pdf
Matlab practical ---4.pdfMatlab practical ---4.pdf
Matlab practical ---4.pdf
 
Matlab practical ---3.pdf
Matlab practical ---3.pdfMatlab practical ---3.pdf
Matlab practical ---3.pdf
 
Matlab practical ---2.pdf
Matlab practical ---2.pdfMatlab practical ---2.pdf
Matlab practical ---2.pdf
 
Matlab practical --8.pdf
Matlab practical --8.pdfMatlab practical --8.pdf
Matlab practical --8.pdf
 

Recently uploaded

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Dr.Costas Sachpazis
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxpurnimasatapathy1234
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).pptssuser5c9d4b1
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Christo Ananth
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSISrknatarajan
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINESIVASHANKAR N
 

Recently uploaded (20)

APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
Sheet Pile Wall Design and Construction: A Practical Guide for Civil Engineer...
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
Microscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptxMicroscopic Analysis of Ceramic Materials.pptx
Microscopic Analysis of Ceramic Materials.pptx
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINEMANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
 

Matlab practical ---1.pdf

  • 1.
  • 2. MATLAB ASHOK(191890) PRACTICAL-1 Practical-1: Introduction to MATLAB. Theory: . MATLAB is a programming language developed by MathWorks. It started out as a matrix programming language where linear algebra programming was simple. It can be run both under interactive sessions and as a batch job. .MATLAB (matrix laboratory) is a fourth-generation high-level programming language and interactive environment for numerical computation, visualization and programming. . It allows matrix manipulations; plotting of functions and data; implementation of algorithms; creation of user interfaces; interfacing with programs written in other languages, including C, C++, Java, and FORTRAN; analyze data; develop algorithms; and create models and applications. . It has numerous built-in commands and math functions that help you in mathematical calculations, generating plots, and performing numerical methods. Uses of MATLAB: MATLAB is widely used as a computational tool in science and engineering encompassing the fields of physics, chemistry, math and all engineering streams. It is used in a range of applications including – . Signal Processing and Communications . Image and Video Processing . Control Systems . Test and Measurement . Computational Finance . Computational Biology MATLAB Environment: . Command Window . Command History . Workspace . Current Directory . Edit Window . Figure Window Command Window:
  • 3. MATLAB ASHOK(191890) Whenever MATLAB is invoked, the main window called command window is activated. The command window displays the command prompt’>>’ and a cursor where commands are entered and are executed instantaneously. Command History: Command history window consists of a list of all the commands that are entered at the command window. These commands remain in the list until they are deleted. Any command may be executed by selecting and double clicking it with the mouse. Workspace: A workspace is a collection of all the variables that have been generated so far in the current MATLAB session and shows their data type and size. All the commands executed from Command Window and all the script files executed from the Command Window share common workspace, so they can share all the variables.
  • 4. MATLAB ASHOK(191890) Current Directory: The Current Directory window contains all the files and folders present in the Current Directory. To run any file, it must either be in the Current Directory or on the search path. Edit Window: An Edit Window is used to create a new program file, or to modify existing files. In this window, programs can be written, edited and saved. The programs written using the MATLAB editor are automatically assigned an extension (.m) by the editor and are known as M- files. Figure Window: A Figure Window is a separate window with default white background and is used to display MATLAB graphics. The results of all the graphic commands executed are displayed in the figure window.
  • 5. MATLAB ASHOK(191890) Introduction: a) Making variables :---------------------- a = 2; it's a number a = '2'; it's a string a = [1 2 3 4 5]: it's a vector(array) (in JAVA: int array[] = new int[5]) a = [ 1 2; 3 4] it's a matrix (in JAVA: int array[][] = new int[2][2]) a = {'a',2;'b',3} it's a cell (in JAVA structure)
  • 7. MATLAB ASHOK(191890) • Magic(): create square matrix n*n • Transpose():transpose of the matrix • Flipup():flip the matrix up and down • Filplr():flip the matrix left to right
  • 8. MATLAB ASHOK(191890) • Inv(): inverse of the matrix • a.^2 : square of matrix • eye() : identity matrix • rand(): create a matrix from random number
  • 9. MATLAB ASHOK(191890) C) Basic plot 1) 2-D plot 2) 3-D plot Syntax • plot(X,Y) • plot(X,Y,LineSpec) ---creates the plot using the specified line style, marker, and color. • plot(X1,Y1,...,Xn,Yn)-- plots multiple pairs of x- and y-coordinates on the same set of axe
  • 10. • MATLAB ASHOK(191890) • plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)-- assigns specific line styles, markers, and colors to each x-y pair. • plot(Y)-- plots Y against an implicit set of x-coordinates
  • 11. • MATLAB ASHOK(191890) • plot(Y,LineSpec)--- plots Y using implicit x-coordinates, and specifies the line style, marker, and color. • plot(tbl,xvar,yvar)--- plots the variables xvar and yvar from the table tbl. • plot(tbl,yvar)--- plots the specified variable from the table against the row indices of the table.
  • 12. • MATLAB ASHOK(191890) • plot(ax,___)--- displays the plot in the target axes. Specify the axes as the first argument in any of the previous syntaxes. • plot(___,Name,Value)-- specifies Line properties using one or more name-value arguments.
  • 13. • MATLAB ASHOK(191890) • p = plot(___)--- returns a Line object or an array of Line objects.
  • 14. • MATLAB ASHOK(191890) 3-D Plot 3-D point or line plot • plot3(X,Y,Z) • plot3(X,Y,Z,LineSpec) • plot3(X1,Y1,Z1,...,Xn,Yn,Zn)