【信号处理工具箱】—信号表示方法

目录

1、工具箱中常见的函数

(1)sawtooth函数

(2) square函数

(3) sinc函数

(4)rectpuls函数

(5)tripuls函数

(6)chirp函数

(7)pulstran函数

(8) diric函数

(9) gauspuls函数

(10) gmonopuls函数和vco函数

2、离散信号表示

(1)离散信号

(2) 单位脉冲序列

(3)单位阶跃序列

(4)实指数序列 

(5) 复指数序列

(6)正(余)弦序列


1、工具箱中常见的函数

(1)sawtooth函数

   sawtooth函数用于产生锯齿波或三角波信号,格式如下:

   x=sawtooth(t),产生周期为2\pi,幅值-1—1的锯齿波,在2\pi的整数倍取值为1或-1。斜率为1/\pi

   sawtooth(t,width),产生三角波,width介于0到1。

t=0:0.0001:1;
y=sawtooth(2*pi*50*t);
subplot(211);
plot(t,y)
axis([0,0.2,-1,1]);
y1=sawtooth(2*pi*50*t,0.5);
subplot(212);
plot(t,y1)
axis([0,0.2,-1,1]);

(2) square函数

   square函数用于产生方波信号,调用格式为:

   x=square(t),产生周期为2\pi,幅值为-1到1。

   x=square(t,duty),产生指定的周期信号,duty为正半周期所占比例。

t=0:0.0001:1;
y1=square(2*pi*50*t);
subplot(211);
plot(t,y1)
axis([0,0.2,-2,2]);
xlabel('方波信号');
y2=square(2*pi*50*t,70);
subplot(212);
plot(t,y2)
axis([0,0.2,-2,2]);
xlabel('正半周期所占比例为70%');

(3) sinc函数

   sinc函数表示为:sinc(t)=\left\{\begin{matrix} 1,t=0\\ \frac{sin(\pi t)}{\pi t} ,t\neq0 \end{matrix}\right.,其调用格式为:y=sinc(t)。

x=linspace(-4,4,200);
y=sinc(x);
plot(x,y)

(4)rectpuls函数

   rectpuls函数用于产生非周期方波信号,调用格式:

   y=rectpuls(t), y=rectpuls(t,w),产生指定宽度为w的非周期方波。

t=0:0.01:2;
y1=rectpuls(t);%默认0.5
subplot(211);
plot(t,y1)
axis([0,2,-2,2]);
y2=rectpuls(t,0.8);%0.4处
subplot(212);
plot(t,y2);
axis([0,2,-2,2]);

(5)tripuls函数

   tripuls用于产生非周期三角波信号,格式:

   y=tripuls(t,w,s),产生指定宽度为w的非周期三角波,斜率为s(-1—1)。

t=-1:0.01:1;
y=tripuls(t,1,-1);
plot(t,y)
axis([-1,1,-2,2]);

(6)chirp函数

   chirp函数用于产生线性调频扫频信号,格式:

   y=chirp(t,f0,t1,f1),产生一个线扫频信号。(默认值:f0=0HZ,t1=1,f1=100HZ)。

   y=chirp(t,f0,t1,f1,'method'),method为调频方法有:linear(线性)、quadratic(二次)、logarithmic(对数),默认线性。

t=0:0.01:1;
y=chirp(t,0,1,200);
plot(t,y)
axis([0,1,-1,1]);

(7)pulstran函数

   pulstran用于产生冲击串函数,格式:

   y=pulstran(t,d,'func'),指定时间范围t,位移d,连续函数func。

t=0:0.001:1;
d=0:0.25:1;
y=pulstran(t,d,'square');
plot(t,y)

(8) diric函数

   diric函数用于产生Dirichelt信号,格式:

   y=diric(x,n),用于产生x的Dirichelt函数。

x=0:10;
y=diric(x,3);
plot(x,y)

(9) gauspuls函数

   gauspuls函数用于产生高斯正弦脉冲信号,格式:

   y=gauspuls(t,fc,bw,bwr),返回持续时间t,中心频率fc,带宽bw。幅度为1的高斯正弦脉冲信号的抽样。

   tc=gauspuls('cutoff',fc,bw,bwr,tpe),返回值按照参数tpe计算所对应的截断时间tc。

   例:产生频率为60KHZ,宽度为80%的高斯RF脉冲信号,要求脉冲包络下降到60dB(默认值)截断。

tc=gauspuls('cutoff',60000,0.8,[ ],-60);
t=-tc:0.000000001:tc;
y=gauspuls(t,60000,0.8);
plot(t,y)

(10) gmonopuls函数和vco函数

   gmonopuls函数用于产生高斯单脉冲信号,vco函数时电压控制震荡函数。

2、离散信号表示

(1)离散信号

   如果表示为:x(2)=-2,x(1)=1,x(0)=3,x(-1)=4,x(-2)=6,1其余为0。

t=-3:3;
x=[0 6 4 3 1 -2 0];
stem(t,x)
grid

(2) 单位脉冲序列

   \delta (n-n_{0})=\left\{\begin{matrix} 1,n=n_{0}\\ 0,n\neq n_{0} \end{matrix}\right.

x=zeros(1,6);
x(1,2)=1;
n=0:5;
stem(n,x)

(3)单位阶跃序列

   u(n-n_{0})=\left\{\begin{matrix} 1,n\geqslant n_{0}\\ 0,n\leq n_{0} \end{matrix}\right.

n=[-11:11];
x=[(n-3)>=0];
stem(n,x)

(4)实指数序列 

   x(n)=a^{n}

n=1:11;
x=2.^n;
stem(n,x)

(5) 复指数序列

   x(n)=e^{(\delta +jw)n}

n=1:10;
x=exp((1+j).*n);
subplot(211);
stem(n,real(x))
subplot(212);
stem(n,imag(x))

(6)正(余)弦序列

   x(n)=cos(wn+\theta )

n=1:0.1:10;
x=cos(0.5*pi.*n);
stem(n,x)

发布了64 篇原创文章 · 获赞 70 · 访问量 1万+

猜你喜欢

转载自blog.csdn.net/fanjufei123456/article/details/104459498