Graphics Reference
In-Depth Information
eXerCISe 2-1
represent the graphs of the functions Sine(x), Sine(2x) and Sine(3x), varying in the range (0,2 p ) for x, all on the
same axes.
the graphics, generated by the input is represented in Figure 2-3 :
fplot (@(x)[sin(x), sin(2*x), sin(3*x)], [0, 2 * pi])
Figure 2-3.
it may be useful to differentiate between curves by their strokes, for instance if you cannot assume that your
ultimate user of the graph can print in color. For variety, in Figure 2-4 we represent the first function, Sine (x) ,
with a black line, the second, Sine(2x) , using blue star, and the third, Sine (3x) , with red circles. we use the
following syntax:
>> x = (0:0.05:2*pi);
>> y1 = sin(x); y2 = sin(2*x); y3 = sin(3*x);
>> plot(x,y1,'k-',x,y2,'b*',x,y3,'ro')
Search WWH ::




Custom Search