Programming and Graphics

(Kiana) #1

F.8Matlabgraphics 363



  • Paint a polygon in black:


>> x =[0.0 1.0 1.0]; y=[0.0 0.0 1.0]; c=’k’;
>> fill (x,y,c)
>> set(gca,’fontsize’,15)

(^00) 0.2 0.4 0.6 0.8 1
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1



  • mesh plot:


>> [x, y] = meshgrid(-1.0:0.10:1.0, -2.0:0.10:2.0);
>> z = sin(pi*x+pi*y);
>> mesh(z)
>> set(gca,’fontsize’,15)

0
10
20
30 0 10 20 30

40 50

−1

−0.5

0

0.5

1
Free download pdf