条形图是其中每个点都由垂直条或水平条表示的图。
句法
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]);
输出
评论前必须登录!
注册