Saturday, 22 November 2008

MATLAB Overview

Matlab is a commercial "Matrix Laboratory" package which operates as an interactive programming environment. Matlab is well adapted to numerical experiments since the underlying algorithms for Matlab's builtin functions and supplied m-files are based on the standard libraries LINPACK and EISPACK.
Matlab program and script files always have filenames ending with ".m". The programming language is straightforward since almost every data object is assumed to be an array. Graphical output is available to supplement numerical results.
Online help is available from the Matlab prompt (a double arrow), both generally (listing all available commands):

>> help
[a long list of help topics follows]
and for specific commands:

>> help fft
[a help message on the fft function follows].

How to quit Matlab?

Leave a Matlab session by typing

quit
or by typing

exit
to the Matlab prompt.


Building Matrices
Matlab has many types of matrices which are built into the system.

A 7 by 7 matrix with random entries is produced by typing
rand(7)

To generate random matrices of other sizes :
rand(4,6)

To get Hilbert Matrix
hilb(5)

A 5 by 5 magic square :
magic(5)
Tip: A magic square is a square matrix which has equal sums along all its rows and columns. Matrix multiplication is used to check this property.


Some standard matrices from linear algebra :
eye(6)
zeros(4,7)
ones(5)

Single row matrix(the entered values are shown):
[1 2 3 5 7 9]

A 3x3 matrix:
[1, 2, 3; 4, 5, 6; 7, 8, 9]

Variables
Some Built-in variables : pi,eps,ans
To know the active variables at any time use who:
who
help who
To remove a variable
clear x
x
who



querrymail@gmail.com

0 comments: