这期主要是特殊符号的输入,像是希腊字母输入,上下标控制这些。同时,介绍极坐标绘图函数——polarplot()
代码总览:
极坐标绘图
运行结果:
极坐标绘图
theta = 0:0.01*pi:2*pi;%角度 rho = 10*exp(theta/4);%极径 subplot(1,2,1);%布局为1行2列,目前绘制第1幅图 polarplot(theta,rho,'k-','LineWidth',1.5);%极坐标绘图 title('\rho = 10*e^\theta','FontSize',15);%添加标题,这里采用"^"来控制上标,采用“\theta”来输入希腊字母(详情见附录),也可以利用word等软件插入字符后复制粘贴过来。
text(pi/6,20,'\leftarrow对数螺线','FontSize',... 15,'color','b','FontName','楷体');%注释说明,前两个参数pi/6,20用来控制文本坐标位置。 hold on; r = sin(2*theta).*cos(2*theta); subplot(1,2,2); polarplot(theta,r,'r-','LineWidth',1.5); title('r=sin(2θ)*cos(2θ)','FontSize',15);%这里的θ是复制粘贴过来的
附录:(来自MATLAB帮助文档)
PS:希腊字符不好记的话,可以采用复制粘贴的方法输入,或者采用输入法特殊字符输入。
输入控制
希腊字符