一.Sa函数
功能:产生Sinc或sin(pi*t)/(pi*t)函数波形.
格式:y = sinc(x)
代码如下:
x = linspace(-5,5);
y = sinc(x);
plot(x,y);
结果如下:
二.调频余弦信号
功能:产生调频余弦信号
格式:y = chirp(t,f0,t1,f1)
y = chirp(t,f0,t1,f1,'method')
y = chirp(t,f0,t1,f1,'method',phi)
说明:chirp函数产生调频余弦信号,即信号的频率随时间的增长而变化.
y = chirp(t,f0,t1,f1,'method')产生的余弦信号y,t为时间轴.在t=0时,f0为信号频率;t=t1时买f1为信号频率,此时单位为Hz。信号的频率随时间作线性变化。
y = chirp(t,f0,t1,f1,'method'),通过method参数设置频率随时间变化的方式,即
method = linear时,频率
method = quadratic时,频率
method = logarithmic时,频率,其中
代码如下:
t = 0:0.001:2;
y1 = chirp(t,0,1,2);
subplot(3,1,1);plot(t,y1);
y2 = chirp(t,0,1,2,'linear');
subplot(3,1,2);plot(t,y2,'r');
y3 = chirp(t,0,1,2,'quadratic');
subplot(3,1,3);plot(t,y3,'b');
结果如下:
三. 冲激串
功能:产生冲激串。
格式:y = pulstran(t,d,'func')
y = pulstran(t,d,p,Fs)
y = pulstran(t,d,p)
说明:y = pulstran(t,d,'func')产生由func指定函数的形状、t为时间轴、d为采样间隔。func可选函数为:gauspuls,高斯调制正弦信号;rectpuls,非周期的矩形波、tripuls,非周期的三角波。
y = pulstran(t,d,p,Fs)由冲激函数原型向量p通过采样与延迟组合成冲激串y,d为采样间隔,Fs为采样频率,缺省值为1Hz。
代码示例如下:
t = 0:1/1e3:1;
d = 0:1/3:1;
y1 = pulstran(t,d,'tripuls',0.1,-1);
subplot(3,1,1),plot(t,y1);
y2 = pulstran(t,d,'rectpuls');
subplot(3,1,2),plot(t,y2);
y3 = pulstran(t,d,'gauspuls');
subplot(3,1,3),plot(t,y3);
结果如下: