300 likes | 393 Views
Introduction to Matlab The language of technical computing. By:- ANKIT RAJ 2010AATS031U. What is MATLAB?. MATLAB stands for “ MATrix LABoratory ”.
E N D
Introduction to MatlabThe language of technical computing By:- ANKIT RAJ 2010AATS031U
What is MATLAB? MATLAB stands for “MATrix LABoratory”. MATLAB is a tool for doing numerical computations with matrices and vectors. It is very powerful and easy to use. It integrates computation, graphics and programming in the same environment.
Matlab basic elements:- • Array: A collection data values organized into rows and columns and known by a single name.
Arrays: • The fundamental unit of data in MATLAB. • Scalars are also treated as data in MATLAB (1 row and 1 column) • Row and column indices of an array start from 1. • Arrays can be classified as vectors and matrices.
Vector: Array with one dimension • Matrix: Array with more than one dimension. • Size of an array is specified by the number of rows and the number of columns ,with the number of rows mentioned first.(For example: n x m array) total number of elements in an array is the product of the number of rows and the number of columns.
Matrix operations • Arithmetic operators: variable_name= expression;
Variables: • A region of memory containing an array, which is known by a user-specified name. • Contents can be used or modified at any time. • Variable name must begin with a letter, followed by any combination of letters, numbers and the underscores (_) character. Only the first 31 characters are significant. • The MATLAB language is Case Sensitive.JOHN,john,John are all different variables.
The display function:disp(array) >> disp(‘Hello’) Hello >> disp 5 5 >> disp( [‘BITS’ ‘Dubai’ ] ) BITS Dubai >> name= ‘ students’; >> disp( [ ‘Hello’ name ] ) Hello students
Basic Matlab Coding: • Code for eigenvalue picture b = linspace(0, 10,30) ; c = linspace(0, 10,30) ; [b, c] = meshgrid(b, c) ; s = 1+sqrt(b * c) ; mesh(b, c, s) grid on