0% found this document useful (0 votes)
2 views5 pages

NM Lab 01

This document serves as an introduction to MATLAB, detailing its various windows including the Command Window, Editor Window, and Help Window, along with their functionalities. It covers basic operations such as arithmetic, display formats, and built-in math functions, as well as commenting and clearing commands. The document aims to familiarize users with MATLAB's interface and basic computational capabilities.

Uploaded by

Naeem Hanif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views5 pages

NM Lab 01

This document serves as an introduction to MATLAB, detailing its various windows including the Command Window, Editor Window, and Help Window, along with their functionalities. It covers basic operations such as arithmetic, display formats, and built-in math functions, as well as commenting and clearing commands. The document aims to familiarize users with MATLAB's interface and basic computational capabilities.

Uploaded by

Naeem Hanif
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

Lab #01

Introduction to MATLAB
Starting with MATLAB
1- MATLAB Windows:
MATLAB windows contain four smaller windows are as:

Command Window
The Command Window enables you to enter individual statements at the command line, indicated by
the prompt (>>). As you enter statements, the Command Window displays the results.

This table describes some additional actions that you can perform in the Command Window.

Action How to Perform the Action

Enter multiple statements Enter the multiple statements at the command line, pressing Shift+Enter between statements.
on multiple lines before
running any of the This key combination is unnecessary when you enter a paired keyword statement on multiple lines, such
statements. as for and end.

Clear a statement from Press the Escape (Esc) key.


the command line without
executing it.
Recall previous Press the Up arrow ↑ key. The Command History window opens and displays a log of previous statements.
statements.
To recall a specific statement, type any part of the statement and then press the Up arrow key. For
example, to recall the command b = 2, type b, and then press the Up arrow key.
Clear the Command Call the clc function.
Window.
To clear the Command Window without deleting any text, call the home function instead. Calling
the home function moves the cursor to the upper-left corner of the Command Window and scrolls all
visible text out of view, giving the appearance of clearing the screen without deleting any text.
Evaluate a statement Select a statement, right-click, and then select Evaluate Selection.
already in the Command
Window.
Execute only a portion of Select the code at the command line and press Enter.
the code currently at the
command line.
Figure Window
In MATLAB, the Features Window isn't a standard term that refers to a specific built-in window or GUI
component like the Command Window, Editor, or Workspace. However, based on context, "Features
Window" might refer to one of the following:

 Feature Extraction Tool or Window


 Programmatic Feature Matrix Display
 App-Specific GUI
 TL;DR

Editor Window
The ‘Editor Window’ in MATLAB is where you write, edit, and save code files, such as:

 .m files (scripts and functions)

 .mlx files (live scripts)

It’s part of MATLAB’s IDE (Integrated Development Environment) and is especially useful for developing
longer code, debugging, and organizing projects.

Key Features of the Editor Window

Feature Description

Syntax Highlighting Colors keywords, comments, and variables for better readability.

Line Numbers Helpful for debugging and navigation.

Code Folding Allows you to collapse/expand functions or code blocks.

Breakpoints You can set breakpoints for debugging.

Run Section Run specific sections of code using "%%" section breaks.

Live Scripts (.mlx) Mix code, output, formatted text, equations, and images interactively.

Help Window
The Help Window in MATLAB is a built-in interface that provides documentation, examples,
explanations, and guides for using MATLAB functions, toolboxes, and features. It's essentially your go-to
place when you need to understand how something in MATLAB works.
Working in the Command Window
The Semicolon:

From this command is not displayed.

Typing %:

When the symbol is used at the beginning of a line, the line is designated as a comment.

The Clc Command:

To clear the command window.


Arithematic Operations
In MATLAB, you can perform arithmetic operations using symbols by leveraging the Symbolic Math
Toolbox. This toolbox lets you define symbolic variables and perform operations like addition,
subtraction, multiplication, division, powers, and more — symbolically, just like in algebra.

 Sum Expr = x + y
 Difference Expr = x - y
 Product Expr = x * y
 Division Expr = x / y
 Power Expr = x^2 + y^2

MATLAB as a Calculator

Display Formats
MATLAB has several other formats for displaying numbers.

 >>% using format %


 >> format long
 >> format short
 >> format bank
 >> format loose
 >> format compact

Elementary Math Build-in Functions


Several build in math functions are as:

 Sqrt(x)
 Nthroot(x,n)
 Exp(x)
 Abs(x)
 Log(x)
 Factorial(5)
Trignometric Math Functions
Trigonometric math functions are as:

 Sind(x)
 Cosd(x)
 Tand(x)
 Cotd(x)

Other Rounding Functions


Several rounding functions are as:

 Round(x)
 Fix(x)
 Ceil(x)
 Floor(x)
 Rem(x)
 Sign(x)

You might also like