Skip to main content

MATLAB Instruction manual

 

What is MATLAB?

 

The name MATLAB stands for “MATrix LABoratory” and was originally designed as a tool for doing

numerical computations with matrices and vectors. It has since grown into a high-performance language

for technical computing. MATLAB, integrating computation, visualization, and programming in an easyto-

use environment, allows easy matrix manipulation, plotting of functions and data, implementation of

algorithms, creation of user interfaces, and interfacing with programs in other languages. Typical uses

include:

 

• Math and Computation

 

• Modeling and Simulation

 

• Data Analysis and Visualization

 

• Application Development

 

• Graphical User Interface development


Window Layout:

The first time you start MATLAB, the desktop appears with the default layout, as shown in Figure 1.

The following tools are managed by the MATLAB desktop:

Command Window: Run MATLAB statements.

Current Directory Browser: To search for, view, open, find, and make changes to MATLAB

related directories and files, use the MATLAB Current Directory browser.

Command History: Displays a log of the functions you entered in the Command Window, copy

them, execute them, and more.

Workspace Browser: Shows the name of each variable, its value, and the Min and Max calculations,

which MATLAB computes using the min and max functions, and updates automatically.

In case that the desktop does not appear with the default layout, you can change it by the menu

Desktop ! Desktop Layout ! Default.

The desktop includes these panels:

Current Folder - This panel allows you to access the project folders and files.

Command Window - This is the main area where commands can be entered at the command line. It is indicated by the command prompt (>>).


In order to run the program, type the name of the file containing your program at the prompt. When typing the filename in the command window do not include ". m". By pressing enter, MATLAB will run your program and perform all the commands given in your file.

Workspace - The workspace shows all the variables created and/or imported from files.


 To open the Workspace browser, select Workspace from the Desktop menu in the MATLAB desktop, or type workspace at the Command Window prompt. The Workspace browser opens. The Workspace browser shows the name of each variable, its value, its array size, its size in bytes, and the class.

 Command History - This panel shows or rerun commands that are entered at the command line.





 

You are now faced with the MATLAB desktop on your computer, which contains the prompt

(>>) in the Command Window. Usually, there are 2 types of prompt:

>>For full version

EDU> for educational version

 

 

Note:

1. To simplify the notation, we will use this prompt, >>, as a standard prompt sign, though our MATLAB version is for educational purpose.

2. MATLAB adds variable to the workspace and displays the result in the Command Window.

 

Managing workspace and file commands Command

Description

cd

Change current directory

clc

Clear the Command Window

clear (all)

Removes all variables from the workspace

clear x

Remove x from the workspace

copy file

Copy file or directory

delete

Delete files

dir

Display directory listing

exist

Check if variables or functions are defined

help

Display help for MATLAB functions

look for

Search for specified word in all help entries

mkdir

Make new directory

move file

Move file or directory

pwd

Identify current directory

rmdir

Remove directory

type

Display contents of file

what

List MATLAB files in current directory

which

Locate functions and files

who

Display variables currently in the workspace

whos

Display information on variables in the workspace

 Commonly used Operators and Special Characters

 

MATLAB supports the

following 

commonly used operators and special characters:

MATLAB supports the

following 

commonly used operators and special characters:

Operator              Purpose 

                

 

 

 


+

Plus; addition operator.

-

Minus; subtraction operator.

*

Scalar and matrix multiplication operator.

.*

Array multiplication operator.

^

Scalar and matrix exponentiation operator.

.^

Array exponentiation operator.

\

Left-division operator.

/

Right-division operator.

.\

Array left-division operator.

./

Array right-division operator.

:

Colon; generates regularly spaced elements and represents an entire row or column.

( )

Parentheses; encloses function arguments and array indices; overrides precedence.

[ ]

Brackets; enclosures array elements.

.

Decimal point.

Ellipsis; line-continuation operator

,

Comma; separates statements and elements in a row

;

Semicolon; separates columns and suppresses display.

%

Percent sign; designates a comment and specifies formatting

_

Quote sign and transpose operator.

._

Non-conjugated transpose operator.

=

Assignment operator.

 

Naming Variables

Variable names consist of a letter followed by any number of letters, digits or underscore.

MATLAB is case-sensitive.

Variable names can be of any length; however, MATLAB uses only first N characters, where N is given by the function namelengthmax.

 

Saving Your Work

The save command is used for saving all the variables in the workspace, as a file with .mat extension, in the current directory.

For example, save myfile

You can reload the file anytime later using the load command.

load myfile .

Comments

  1. I highly recommend the MATLAB instruction manual for anyone who is new to MATLAB or wants to improve their understanding of the software. It is a comprehensive and well-written resource that can help users unlock the full potential of MATLAB for their work.

    ReplyDelete
  2. Prof. V. L. JagtapApril 23, 2023 at 3:34 PM

    Very nicely explained

    ReplyDelete
  3. Prepare it for scilab also if possible

    ReplyDelete
  4. very useful for mathematical operations

    ReplyDelete

Post a Comment

Popular posts from this blog

Online GDB

Introduction:  GDB is a debugger for C (and C++). It allows you to do things like run the program up to a certain point then stop and print out the values of certain variables at that point, or step through the program one line at a time and print out the values of each variable after executing each line. DB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, OCaml, VB, Perl, Swift, Prolog, JavaScript, Pascal, COBOL, HTML, CSS, JS. Code, Compile, Run and Debug online from anywhere in world .   Execution Plan:   The teacher explains some topics by using this debugger and given demonstration regarding how to use GDB .    Outcomes:  1. Students can get knowledge of GDB it speed up programming.   User Manual 

Understanding Java: A Powerful and Versatile Programming Language

Java is one of the most widely used programming languages in the world. It has a rich history and continues to play a pivotal role in software development across various domains. Whether you're building mobile apps, developing web applications, or working on enterprise-level systems, Java offers the tools and flexibility needed to create robust and scalable software. The Origins of Java Java was first developed by Sun Microsystems in the mid-1990s and was later acquired by Oracle Corporation. The language was initially designed to have a "write once, run anywhere" capability, meaning that code written in Java can run on any platform that supports Java without the need for recompilation. This cross-platform feature is made possible by the Java Virtual Machine (JVM), which interprets Java bytecode and executes it on the host machine. Key Features of Java Platform Independence : One of Java's standout features is its platform independence. Java programs are compiled into...

Tinkercad

    Tinkercad is a free, web-based 3D design and modeling software primarily geared towards beginners, educators, and hobbyists. Created by Autodesk, Tinkercad allows users to easily create 3D models, circuit designs, and simulations without needing any prior experience in CAD (Computer-Aided Design). The software emphasizes user-friendliness, providing a simple interface for designing 3D models and simulating electronic circuits, making it ideal for educational purposes and quick prototyping.   Tinkercad is widely used for various purposes such as 3D printing, creating design prototypes, and teaching electronics. It provides access to an online community where users can share their designs, collaborate with others, and explore various project ideas.   Installing steps: Since Tinkercad is a cloud-based platform, there is no installation required on the user's computer. It can be accessed directly through a web browser by following these steps: 1. Go to th...