1. 程式人生 > >20. matlab 中的gtext 函式

20. matlab 中的gtext 函式

例子:

clear            %  clear the all variable of the workspace
t = [0 : pi/12 : 4*pi];      % definate the range of variable t
hold on                         %     pain the diffrent function
axis([0 4*pi -10 10]);    % set the axies xlabe range and ylable range
plot(t, 10*sin(t),'r+:');
plot(t,5*cos(t),'b*--');
xlabel('Time t');
ylabel('Value');
title('The simple draw examples ');
legend('sin(x)','cos(x)');
gtext('x1');              % mark the x1 position use mouse
gtext('x2');
grid on

實驗的資料: