tailieunhanh - Chú thích trên đ th Các lệnh xlabel;

2/9/2010 Chú thích đ th và v bi u đ trong Matlab Chú thích trên đ th Các lệnh xlabel; ylabel title legend text; gtext; 1 2/9/2010 Ví dụ x = -pi:.1:pi;t = -pi/4; y = sin(x); plot(x,y) set(gca,'XTick',-pi:pi/2:pi) set(gca,'XTickLabel',{'-pi','pi/2','0','pi/2','pi'}) xlabel('-\pi \leq \Theta \leq \pi') ylabel('sin(\Theta)') title('Plot of sin(\Theta)') text(-pi/4,sin(-pi/4),'\leftarrow sin(\pi\div4)',. 'HorizontalAlignment','left') legend('sin \theta') hold on plot(t, sin(t),’or’) title legend ylabel text xlabel 2 2/9/2010 plotyy - V đ th trên 2 tung đ khác nhau t=0:900; A=1000; a=; b=; y1 = A*exp(-a*t); y2 = sin(b*t); plotyy(t,y1,t,y2) subplot – v nhi u đ th trong cùng m t c a s subplot(m,n,p) Ví dụ t = 0:pi/20:2*pi; [x,y] = meshgrid(t); subplot(2,2,1) plot(sin(t),cos(t)) axis equal subplot(2,2,2) z = sin(x)+cos(y); plot(t,z) axis([0. | 2 9 2010 Chú thích đồ thị và vẽ biểu đồ trong Matlab Chú thích trên đồ thị Các lệnh xlabel ylabel title legend text gtext 1 2 9 2010 Ví dụ x -pi .1 pi t -pi 4 y sin x plot x y set gca XTick -pi pi 2 pi set gca XTickLabel -pi pi 2 0 pi 2 pi xlabel - pi leq Theta leq pi ylabel sin Theta title Plot of sin Theta text -pi 4 sin -pi 4 leftarrow sin pi div4 . HorizontalAlignment left legend sin theta hold on plot t sin t or xlabel 2 2 9 2010 plotyy - Vẽ đồ thị trên 2 tung độ khác nhau t 0 900 A 1000 a b y1 A exp -a t y2 sin b t plotyy t y1 t y2 subplot - vẽ nhiều đồ thị trong cùng một cửa sổ subplot m n p Ví dụ t 0 pi 20 2 pi subplot 2 2 3 x y meshgrid t z sin x . cos y subplot 2 2 1 plot t z plot sin t cos t axis 0 2 pi -1 1 axis equal subplot 2 2 4 z sin x .A2 - cos y . A2 subplot 2 2 2 plot t z z sin x cos y axis 0 2 pi -1 1 plot t z axis 0 2 pi -2 2