for i=1:10
x=linspace(0,10,101);
plot(x,sin(x+i));
print(gcf,'-deps',strcat('plot',num2str(i),'.ps'));
end
1. linspace生成线性间距向量
用法:y=linspace(x1,x2) 返回包含 x1
和 x2
之间的 100 个等间距点的行向量
y=linspace(x1,x2,n) 返回包含 x1
和 x2
之间的n个等间距的行向量
2. plot二维线图
用法:plot(X,Y)
plot(X,Y,LineSpec)
plot(X1,Y1,...,Xn,Yn)
plot(X1,Y1,LineSpec1,...,Xn,Yn,LineSpecn)
3. print打印图窗或保存为特定文件格式
用法:print(filename,formattype)
print(filename,formattype,formatoptions)
4. strcat水平串联字符串
用法:s = strcat(s1,...,sN)
>> s1='good';
>> s2='morning';
>> strcat(s1,s2)
ans =
'goodmorning'
5. num2str将数字转换为字符数组