Graphs in Matlab
This chapter will continue exploring the plotting and graphics capabilities of MATLAB. We will discuss − Drawing bar charts Drawing contours Three dimensional plots Drawing Bar Charts The bar command draws a two dimensional bar chart. Let us take up an example to demonstrate the idea. Example Let us have an imaginary classroom with 10 students. We know the percent of marks obtained by these students are 75, 58, 90, 87, 50, 85, 92, 75, 60 and 95. We will draw the bar chart for this data. Create a script file and type the following code − x = [ 1 : 10 ]; y = [ 75 , 58 , 90 , 87 , 50 , 85 , 92 , 75 , 60 , 95 ]; bar ( x , y ), xlabel ( 'Student' ), ylabel ( 'Score' ), title ( 'First Sem:' ) print - deps graph . eps When you run the file, MATLAB displays the following bar chart − Drawing Contours A contour line of a function of two variables is a curve along which the function has a constant value. Contour lines are used for creating contour maps...