Thursday, October 11, 2007

Matlab Tutorial IV

More Fun with Graphs



So if you read the last issue of Matlab Tutorial, Matlab Tutorial III , then you remember the skill of making graphs. We covered the basic two variable plot, titles, labels for the axes, and even the hold on and hold off graphs. Well in this issue we will cover how to distinguish each graph with different visual designs and options.




If you do any kind of customizing for your graphs, at least if you plan on changing the line design, color, and symbol used to represent a line or points, then you must input any of the syntax within the plot command. The two inputs that can be added to the end of your plot command is a letter for a certain color and a symbol for the point marker type.



Different colors that can be selected, at least from the source I found not limited to, are yellow (y), magenta (m), cyan (c), red (r), green (g), blue (b), white (w), and black (k). This syntax comes before the point marker type syntax. Adding color makes it much easier to tell the difference between multiple graphs, especially when they are on the same plot graph.



The different point marker types vary in design and type. Some can be used for a set of points, and some can be used for continuous functions. A few to pick from are point (.), circle (o), X-mark (x), plus (+), solid (-), star (*), dotted (:), dashed-dot (-.), and just dashed (--). Not only does this further individualize each graph you make, but it looks cool too, especially the stars!



So using the above symbols for graph syntax you, write them in the plot function inside their own set of single quotes after the second variable followed by a comma: plot (X, Y, 'r:') This example would give you a plot of red dotted lines.



Well that's all I have to contribute to the Matlab Tutorial, everyone have fun at making their graphs. Stay tune for the next issue and program on!





Resources : CTM: Plotting in Matlab

No comments: