Graphics Reference
In-Depth Information
eXerCISe 2-6
represent a regular octagon (square enclosure), whose vertices are defined by pairs of values
(Sine (t), Cos (t)),
for values of
t
varying between 8
p
and 15
p
/8 separated by 2
p
/8. use only the green color and put the 'octagon'
text at the point (-1/4,0) the inside of the figure.
the syntax for Figure
2-10
is the following:
>> t = [pi/8:2*pi/8:15*pi/8]';
>> x = sin (t);
>> y = cos (t);
>> fill(x,y,'g')
>> axis('square')
>> text(-0.25,0,'OCTOGON)'
Figure 2-10.
2.6 Graphics Functions in Parametric Coordinates 2-D
We are going to see now how the program draws curves in parametric coordinates in the plane. We will discuss how
you can get graphs of functions in which the variables
x
and
y
depend, in turn, on a parameter
t.
The command to
use is
Plot
and all its variants, conveniently defining intervals of the parameter variation, and not the independent
variable, as it was until now.