12.07.2015 Views

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

Basics of MATLAB and Beyond

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

The h<strong>and</strong>le <strong>of</strong> a Figure is the number (1, 2, etc.) that normallyappears in the Figure’s title bar (supplied by the windowing system).All <strong>of</strong> the graphical objects, except the Root object, have low-levelcreation functions in which you can specify their properties. For example,here is how to create a set <strong>of</strong> axes with the x-axis tick marks labelledby months <strong>of</strong> the year:lbls = [’Jan|Feb|Mar|April|May|June|’...’July|Aug|Sept|Oct|Nov|Dec’];clfaxes(’position’,[.1 .5 .8 .1],’xlim’,[1 12],...’xtick’,1:12,’xticklabel’,lbls)The general format <strong>of</strong> object creation functions ish<strong>and</strong>le = function (’propertyname ’,’propertyvalue ’)The output <strong>of</strong> the function is the h<strong>and</strong>le <strong>of</strong> the object. This h<strong>and</strong>lecan then be used in subsequent calls to get <strong>and</strong> set to modify theproperties <strong>of</strong> the object. The propertyname s are displayed by matlabwith capitalisation to make them easier to read; for example, theVerticalAlignment text property or the YAxisLocation axes property.When you are typing property names, you do not need to use the fullname or any capitalisation; you need only use enough letters <strong>of</strong> the propertyname to uniquely specify it, <strong>and</strong> matlab does not care what capitalisationyou use. Nevertheless, when writing m-files, it is a good ideato use the full property name because abbreviated names may no longerbe unique if extra properties are added in future releases <strong>of</strong> matlab.Example: Line WidthThe default way to plot a matrix is to draw one line for each column <strong>of</strong>the matrix, with the lines differentiated by colour. Suppose instead thatwe want to differentiate the lines by their thicknesses. One way to do itis as follows. First generate the data <strong>and</strong> plot it:y = [1:10]’*[1:10];clfplot(y)c○ 2000 by CRC Press LLC

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!