Matlab Fundamentals

Submitted by: Submitted by

Views: 139

Words: 1084

Pages: 5

Category: Other Topics

Date Submitted: 10/02/2013 06:53 AM

Report This Essay

Introduction

 MATLAB (MATrix LABoratory) is a high-level language for

engineering & scientific computations.

 MATLAB allows matrix manipulation, plotting of functions & data,

implementation of algorithms, creation of user interfaces, & interfacing with programs in other languages (such as C & C++).

 An additional package, Simulink, adds graphical multi-domain

simulation and model-based design for dynamic systems.

 MATLAB has a large collection of toolboxes in a variety of domains.

Some examples of MATLAB toolboxes are control system, signal processing, neural network, image processing, & system identification. The toolboxes consist of functions that can be used to perform computations in a specific domain.

213246 Unit 1

Useful MATLAB Commands

Command Description

help command_name

clc clear

Help for functions in command window

Clear command window Remove items from workspace, freeing up system memory

who, whos

format

List variables in workspace

Set display format for output

4 decimal digits (default). 16 decimal digits. 4 decimal digits plus exponent. 15 decimal digits plus exponent. hexadecimal.

213246 Unit 1

Some format commands:

format format format format format short long short e long e hex

Vectors

 Initializing Vectors

a = [1 2 3 4] % a(1) gives first element of a Ta = a’ % Ta is transpose of a b = 1:5 % b = [1 2 3 4 5] c = 1:0.5:3 % c = [1 1.5 2 2.5 3] d = linspace(0,pi/2,10) % creates a vector of 10 equally spaced points from 0 to /2 e = rand(1,7) % vector of seven random numbers

 Array operations refer to element-by-element arithmetic

operations. Preceding the linear algebraic matrix operations (* / ^) by a period (.) indicates an element-by-element operation. For addition & subtraction, array & matrix operations are the same.

a = [1 2 3]; b = [4 5 6]; c = a.*b;

213246 Unit 1

Matrices

 Basic matrix operations are addition(+), subtraction(-),

multiplication (*), division (/), and transpose...