Introduction to Matlab

17
Introduction To MATLAB S.S.R.K.M.GUPTA.M.Tech.,(M.Phil) Assistant Professor

description

This ppt gives introduction to matlab

Transcript of Introduction to Matlab

Introduction To MATLAB

Introduction To MATLABS.S.R.K.M.GUPTA.M.Tech.,(M.Phil)Assistant ProfessorIntroductionMATLAB Stands for MATrix LABoratoryInitially developed by a lecturer Cleve Moler, at the University of New Mexico in 1970s to help students learn linear algebra.It was later marketed and further developed under MathWorks Inc. (founded in 1984) www.mathworks.comMatlab is a software package which can be used to perform analysis and solve mathematical and engineering problems.It has excellent programming features and graphics capability easy to learn and flexible. Available in many operating systems Windows, Macintosh, Unix, DOSIt has several tooboxes to solve specific problems.

MATLAB FunctionalityBuilt-in Functionality includesMatrix manipulation and linear algebraData analysisExploration and visualisationAlgorithm developmentModelling, simulation, and prototypingScientific and engineering graphicsAdd-on toolboxes provideImage processingSignal ProcessingOptimizationGenetic Algorithmsand hundreds of other functions

MATLAB consists ofThe MATLAB languageThe MATLAB working environmentHandle GraphicsThe MATLAB function library. The MATLAB Application Program Interface (API)

Some features of MATLABEverything in MATLAB is a matrix ! MATLAB is an interpreted language, no compilation needed (but possible) MATLAB does not need any variable declarations, no dimension statements, has no packaging, no storage allocation, no pointersPrograms can be run step by step, with full access to all variables, functions etc.What kind of graphics is possible in Matlab?

x = -2.9:0.2:2.9; bar(x,exp(-x.*x)); 66What kind of graphics is possible in Matlab?

Line plot:x=0:0.05:5;y=sin(x.^2);plot(x,y); 77What kind of graphics is possible in Matlab?

Stem plot: x = 0:0.1:4;, y = sin(x.^2).*exp(-x); stem(x,y) 88What kind of graphics is possible in Matlab?

Mesh plot: z=peaks(25); mesh(z); 99What kind of graphics is possible in Matlab?

Surface plot: z=peaks(25);, surf(z);, colormap(jet); 1010What kind of graphics is possible in Matlab?

Contour plot: z=peaks(25); contour(z,16); 1111What kind of graphics is possible in Matlab?

1212MATLAB variablesMatlab treats all variables as matrices. For our purposes a matrix can be thought of as an array, in fact, that is how it is stored.Vectors are special forms of matrices and contain only one row OR one column.Scalars are matrices with only one row AND one columnIdentifiers in MatlabHave not to be previously declaredVariable names can contain up to 63 charactersVariable names must start with a letter followed by letters, digits, and underscores.Variable names are case sensitiveMatlab Special Variablesans Default variable name for resultspi Value of eps Smallest incremental numberinf InfinityNaN Not a number e.g. 0/0realmin The smallest usable positive real numberrealmax The largest usable positive real numberData Types