0% found this document useful (0 votes)
34 views

Introduction To MATLAB: MTH 555: Numerical Analysis

MATLAB is a matrix laboratory program used for numerical computation and data analysis. It allows users to perform matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages. The MATLAB interface includes panels for the current folder, command window, workspace and command history. It supports script and function files written in the MATLAB language for storing and executing sequences of commands. Examples shown include basic arithmetic, plotting functions, matrix operations, solving systems of linear equations, and writing MATLAB functions. Proper documentation and debugging of code is emphasized.

Uploaded by

darebusi1
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
34 views

Introduction To MATLAB: MTH 555: Numerical Analysis

MATLAB is a matrix laboratory program used for numerical computation and data analysis. It allows users to perform matrix manipulations, plotting of functions and data, implementation of algorithms, creation of user interfaces, and interfacing with programs written in other languages. The MATLAB interface includes panels for the current folder, command window, workspace and command history. It supports script and function files written in the MATLAB language for storing and executing sequences of commands. Examples shown include basic arithmetic, plotting functions, matrix operations, solving systems of linear equations, and writing MATLAB functions. Proper documentation and debugging of code is emphasized.

Uploaded by

darebusi1
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Introduction to MATLAB

MTH 555: Numerical Analysis


Introduction
MATLAB stands for MATrix LABoratory.

MatLab
Simulink
Mupad
Toolboxes
Layout panels:
Current Folder Access your files.
Command Window Enter commands at the
command line, indicated by the prompt (>>).
Workspace Explore data that you create or
import from files.
Command History

MatLab

Advance calculator: Variable
execute a sequence of statements stored in a
file.
M-files:
Scripts
Functions (built-in and user-defined)

Examples
Example 1
1
2 +3
2
+
4
5

6
7


1/(2+3^2)+4/5*6/7 versus 1/2+3^2+4/5*6/7
floating point number
MATLAB by default displays only 4 decimals
doc format

Examples contd
Example 2
=

sin () +5
For a = 5, x = 2
y = exp(-a)*sin(x)+5*sqrt(y)
Examples contd
Example 3: A matrix is an array of numbers.


A = [1 2 3; 4 5 6; 7 8 9]
A(2, 3); A(2:3,2:3); A(1,:)
To delete a row or column of a matrix, use the
empty vector operator, [ ].
A(3,:) = []
Transposing: A
Inverse of A (
1
)
Examples contd
Example



A = [1 2 3; 3 3 4; 2 3 3];
b = [1; 1; 2];
x = A\b

Examples contd
M-file
Script
Function
declare the function and add program
statements
function [one,two,three] = myfunction(x)
Good house keeping
MatLab have one of the best documentations
Doc, help, lookfor edit
help command searches for an exact
function name match
lookfor command searches the quick
summary information in each function for a
match
doc function opens the on-line version of
the help manual.

Managing the workspace and command window:
who, clear, clc
You can keep track of everything done during a
MATLAB session with the diary command.
>> diary
To continue a line, type ...
Always write comments for your code
Running code step by step
To perform element-wise multiplication rather
than matrix multiplication, use the .* operator
Reference
Houcque, D. (2005). Introduction to MatLab
for Engineering Students. Michigan:
Northwestern University.
Mathworks

You might also like