版权声明:本文为博主原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。
目录
函数
linspace()
用于产生指定范围内的指定数量点数,相邻数据跨度相同,并返回一个行向量
X=linspace(5,100,20)
将输出:
X =
5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 95 100
plot()
plot(x,y)
plots each vector pairs(x,y)
plot(y)
plots each vector pairs(x,y), wherex=[1…n], n = length(y)
绘制一个圆
假设我们已知圆心坐标(x,y)和半径r,例如
x = 295;
y = 140;
r = 260;
输入以下代码:
theta=0:2*pi/3600:2*pi;
Circlex=x+r*cos(theta);
Circley=y+r*sin(theta);
plot(Circlex,Circley,'b','Linewidth',1);
axis equal
结果如下, 代码 axis equal将横轴纵轴的定标系数设成相同值 ,即单位长度相同,
类似代码 axis square 将当前坐标系图形设置为方形。
也就是说axis square刻度范围不一定一样,但是一定是方形的。
axis equal刻度是等长的,但也不一定是方形的。
Plot Style plot(x,y,‘str’)
plots each vector pairs(x,y) using the format defined in *str
example: plot(x,y,‘or–’)
hold on/off
Use hold on to have both plots in on figure
Lable
lengend()
title()
xlabel() ylabel() zlabel()
text() annotation()