al imam mohammad bin saud islamic university college of sciences department of mathematics

9
AL IMAM MOHAMMAD BIN SAUD ISLAMIC UNIVERSITY COLLEGE OF SCIENCES DEPARTMENT OF MATHEMATICS MATLAB 251 : MATH SOFTWARE Introduction to MATLAB MRS. ASRA SULTANA

Upload: early

Post on 23-Feb-2016

25 views

Category:

Documents


0 download

DESCRIPTION

Al Imam Mohammad Bin Saud Islamic University College of Sciences Department of Mathematics. MATLAB 251 : MATH SOFTWARE Introduction to MATLAB. mrs. Asra Sultana. Introduction to MATLAB. 4. Graphics in MATLAB. 4.7 Color Maps - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

AL IMAM MOHAMMAD BIN SAUD ISLAMIC UNIVERSITY COLLEGE OF

SCIENCESDEPARTMENT OF MATHEMATICS

MATLAB 251 : MATH SOFTWARE

Introduction to MATLAB

MRS. ASRA SULTANA

Page 2: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB4 .Graphics in MATLAB4.7 Color Maps

Matlab uses a matrix called colormap to color surfaces or images.

The colormap is a list of triplets corresponding To the intensities between 0 and 1 of the red, green and blue

ColorBlueGreen RedBlack000White111Red001

Green010Blue100

Yellow011Magenta101

Cyan110Gray0.50.50.5

Dark red000.5

You can create your own colormaps or use any matlab predefined colormaps

Page 3: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB

hsv hot gray bone copper pink white flag lines colorcube jetprism cool autumn spring winter summer

Carry out the following commands and observe

>>peaks;>>colormap(gray(8))

>>m = gray(8);>>imagesc(colormap(m))

Page 4: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB

Vertical barsbarHorizontal barsbarh3D Vertical barsbar33D Horizontal barsbar3hDisplay surfacesarea

Display a piepieDisplay a 3D piepie3

Display an histogram of a certain distributionhist

Display a sequence of discrete valuestem3D displaystem3Display stairs, echelonsstaris

Bars and Surfaces

Pies

Histograms

Discrete data

4.8 Specialized graphs

Page 5: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB

Display vectors centered at 0compassDisplay equally spaced vectors alond an axis featherDisplay vectors in a planequiverDisplay vectors in a spacequiver3

Display level lines labels clabelDisplay level lines in a planecontourDisplay 3D level linescontour3Display level lines by filling the spacescontourf

Vectors

Level lines

>> t = [-2:2]’;>> y = [5 2 1; 8 7 3; 9 8 7; 5 5 5;4 3 2];

Page 6: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB

>>bar(t,y)

>>bar(t,y,’stack’)

Page 7: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB

>>bar3(t,y)

>>area(t,y)

Page 8: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB

>>pie([31 15 8])

>>hist(randn(1000,3))

Page 9: Al  Imam  Mohammad Bin Saud Islamic University  College of  Sciences Department of  Mathematics

INTRODUCTION TO MATLAB