📜  MATLAB 2D Bar()

📅  最后修改于: 2021-01-07 02:36:02             🧑  作者: Mango

MATLAB Bar()

条形图是其中每个点都由垂直条或水平条表示的图。

句法

bar(y) // It creates a bar graph with one bar for each element in y.
bar (x, y) // This function creates a vertical bar plot, with the values in x used to label each bar and the values in y used to determine the height of the bar.

创建条形图

r^2=2 sin 5t, 0≤t≤2π
y = r sin t
t=linspace (0, 2*pi,200);
r=sqrt(abs(2*sin(5*t)));
y=r.*sin(t);
bar (t, y)
axis ([0 pi 0 inf]);

输出: