>> t = linspace(1,2);f = t.*t;g = sin(2*pi*t);
>> xlabel('Time(ms)');
>> ylabel('f(t)');
>> title('Mini Assignment#1');
>> plot(t,f,'k' ,t,g,'or');
>> legend('t^2','sin(2\pit)');
LaTex:
用来表示数学表达式的一种文本
如 str = '$ $\int_{0}^ {2} x ^ 2*sin(x) dx $$ ';
整个式子表示 ∫ 0 2 x 2 ∗ s i n ( x ) d x \int_{0}^ {2} x ^ 2*sin(x) dx ∫02x2∗sin(x)dx
$$表示文本开头/结束,\int_表示积分符号,{0}^{2}表示积分域
- Annotation:
annotation(‘arrow’,‘X’,[0.32,0.5],‘Y’,[0.6,0.4]);
x = linspace(0,3);y = x.^2.*sin(x);plot(x,y);
line([2,2],[0,2^2*sin(2)]);
str = '$$ \ int {0}^ {2} x ^ 2*sin(x) dx $$ ';
text(0.25,2.5,str,'Interpreter','latex');
annotation('arrow','X',[0.32,0.5],'Y',[0.6,0.4]);
**对象属性(部分):**用到对象的继承
其他有用函数:allchild,ancestor,delete,findall
t=0:0.1:2*pi;x=3*cos(t);y=sin(t);
subplot(2,2,1);plot(x,y);axis normal
subplot(2,2,2);plot(x,y);axis square
subplot(2,2,3);plot(x,y);axis equal
subplot(2,2,4);plot(x,y);axis equal tight
Control of Grid,Box,and Axis
grid on/off box on/off axis on/off axis normal/square/equal/equaltight/image/ij/xy
Saving Figures into Files
saves(gcf,’’,’’);