matlab4 MATLAB 绘图
:
[ + | o | * | . | x | square | diamond | v | ^ | > | < | pentagram | hexagram ]
s坐标轴设置返回自动缺
省值
—— 绘制函数图函数
fplot的调用格式:
fplot(fun,lims) — 绘制函数fun在x区间 lims=[xmin xmax]的函数图。
fplot(fun,lims,'corline') — 以指定线形绘图。
[x,y]=fplot(fun,lims) — 只返回绘图点的值,而不绘图。用plot(x,y)来绘图。
fplot('[sin(x),tan(x),cos(x)]',2*pi*[-1 1 -1 1])fplot('humps',[0 1],'rp')
——符号函数的简易绘图函数
ezplot的调用格式:
ezplot(f) —这里f为包含单个符号变量x的符号表达式,在x轴的默认范围
[-2*pi 2*pi]内绘制f(x)的函数图
ezplot(f,xmin,xmax) — 给定区间
ezplot(f,[xmin,xmax],figure(n)) — 指定绘图窗口绘图。
ezplot('sin(x)')ezplot('sin(x)','cos(y)',[-4*pi 4*pi],figure(2))
(二) fill –––– 基本二维绘图函数
fill的功能:
绘制二维多边形并填充颜色
例:x=[1 2 3 4 5];y=[4 1 5 1 4];
fill(x,y,'r')
(三)特殊二维绘图函数
bar –––– 绘制直方图
polar –––– 绘制极坐标图
hist –––– 绘制统计直方图
stairs –––– 绘制阶梯图
stem –––– 绘制火柴杆图
rose –––– 绘制统计扇形图
comet –––– 绘制彗星曲线
errorbar –––– 绘制误差棒图
compass –––– 复数向量图(罗盘图)
feather –––– 复数向量投影图(羽毛图)
quiver –––– 向量场图
area –––– 区域图
pie –––– 饼图
convhull –––– 凸壳图
scatter –––– 离散点图
例,绘制阶梯曲线
x=0:pi/20:2*pi;y=sin(x);stairs(x,y)
例:阶梯绘图
h2=[1 1;1 -1];h4=[h2 h2;h2 -h2];
h8=[h4 h4;h4 -h4];t=1:8;
subplot(8,1,1);stairs(t,h8(1,:));axis('off')
subplot(8,1,2);stairs(t,h8(2,:));axis('off')
subplot(8,1,3);stairs(t,h8(3,:));axis('off')
subplot(8,1,4);stairs(t,h8(4,:));axis('off')
subplot(8,1,5);stairs(t,h8(5,:));axis('off')
subplot(8,1,6);stairs(t,h8(6,:));axis('off')
subplot(8,1,7);stairs(t,h8(7,:));axis('off')
subplot(8,1,8);stairs(t,h8(8,:));axis('off')
h2=[1 1;1 -1];h4=[h2 h2;h2 -h2];
h8=[h4 h4;h4 -h4];
t=1:8;
for i=1:8
subplot(8,1,i);
stairs(t,h8(i,:))
axis('off')
end
例:绘制极坐标绘图
t=0:2*pi/90:2*pi;y=cos(4*t);polar(t,y)
例:绘制火柴杆绘图
t=0::2*pi; y=cos(t); stem(y)
例:绘制直方图
t=0::2*pi; y=cos(t); bar(y)
例:绘制彗星曲线图
t= -pi:pi/500:pi;
y=tan(sin(t))-sin(tan(t)); comet(t,y)
x=magic(6);area(x)
x=[1 2 3 4 5 6 7];y=[0 0 0 1 0 0 0];pie(x,y)
pie(x,
matlab4 MATLAB 绘图 来自淘豆网m.daumloan.com转载请标明出处.