You are on page 1of 27

Lecture 2

Introduction

• Powerful Language
• MATrix-LABoratory
• MATLAB used for…
• MATLAB toolboxes…
Chapter 1 Starting With MATLAB
• Starting with MATLAB

MATLAB Windows
1. Toolstrip
2. Current Folder Toolbar

4. Current Folder Window

3. Command Window

5. Details and Workspace Window


6. Figure Window
7. Editor Window
8. Help Window
9. Command History window
Use this to recover the default view of windows
Dock and Undock command Window
Chapter 1 Working in the command window
• Starting with MATLAB
• Command Window

• Executing commands
• Opening other windows
• Running programs
• Managing the software
Chapter 1 Note for Working in the command window
• Starting with MATLAB
• Command Window

• Curser place Infront of prompt


• Enter Key execute the last command
• Several commands separated by comma
• Use arrow keys for re-execution
• Too long commands can be controlled by ellipsis (…)
or 4096 correctors
• Semicolon (;) for don’t display (multi-commands)
• % use for comments in scripts
• clc only to erase stuff in command window
Chapter 1 Arithmetic Operations with Scalers
• Starting with MATLAB
• Command Window
• Arithmetic Operations
Chapter 1 Order of precedence
• Starting with MATLAB
• Command Window
• Arithmetic Operations
Chapter 1 Using MATLAB as calculator
• Starting with MATLAB
• Command Window
• Arithmetic Operations
Chapter 1 Display Formats
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats

The output format is fixed-point with four decimal


digits (short) by default

format Command
For detail type help format command in command window
Chapter 1 Display Formats
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
Chapter 1 Elementary Math Built-in functions
• Starting with MATLAB
• Command Window
• Arithmetic Operations • sqrt(x)
• Display Formats • nthroot(x,n)
• Built-in Functions • exp(x)
• abs(x)
• log(x)
• log10(x)
• factorial(x)
• Trigonometric functions like sin(x), sind(x), asin(x), asind(x), sinh(x) and
asinh(x)
• pi use for π
• round(x) for round to nearest integer
• fix(x) round toward zero
• ceil(x) round toward infinity
• floor(x) round toward minus infinity
• rem(x,y) return remainder
• sign(x) for signum function
Chapter 1 Defining scaler variables
• Starting with MATLAB
“=” Assignment operator
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables

Variable_name = value, combination of other variables


Chapter 1 Rules about variable name
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables
Chapter 1 Predefined variables and keywords
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables
Chapter 1 Useful Commands for managing variables
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables
• Commands for managing • clear for removal of all variables
variables • clear x y z for specific removal
• who list of used variables
• whos list with detail of varibales
Chapter 1 Script files
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables
• Commands for managing
variables
• Script file
Chapter 1 Creating, saving and running a Script files
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables
• Commands for managing
variables
• Script file
Script File
Chapter 1 Changing the current folder
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables
• Commands for managing
variables
• Script file
Changing the current folder by commands cd('E:\Chapter 1')
Chapter 1 Examples and exercise
• Starting with MATLAB
• Command Window
• Arithmetic Operations
• Display Formats
• Built-in Functions
• Defining scaler variables
• Commands for managing
variables
• Script file Solve and practice on MATLAB
• Examples and exercise

You might also like