前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >1D卷积入门:一维卷积是如何处理数字信号的

1D卷积入门:一维卷积是如何处理数字信号的

作者头像
deephub
发布2020-05-28 22:48:41
2K0
发布2020-05-28 22:48:41
举报
文章被收录于专栏:DeepHub IMBADeepHub IMBA

卷积是在科学、工程和数学中应用最广泛的运算符之一

卷积是对两个函数(f和g)进行的一种数学运算,它产生的第三个函数表示其中一个函数的形状如何被另一个函数修改。

离散时间信号的卷积

一种求解离散时间信号卷积的简单方法如下所示

输入序列x[n] ={1,2,3,4},其索引为{0,1,2,3}

脉冲响应h[n] ={5,6,7,8},其索引为{- 2,1,0,1}

蓝色箭头表示x[n]和h[n]的第0个索引位置。红色指针表示输出卷积索引的第零索引位置。我们可以构造一个表,如下所示。如图所示,将x和h的元素相乘,然后对角相加。

代码语言:javascript
复制
 >> clc;  % clears the command window
 >> clear all; % clears all the variables in the workspace
 >> close all; % closes all the figure window

从用户那里获取输入

代码语言:javascript
复制
 >> % x[n] is the input discrete signal.
 >> x=input('Enter the input sequence x =');
 >> nx=input('Enter the index of the input sequence nx=');
 >> % h[n] is the impulse response of the system.
 >>h=input('Enter the impulse response of the system,second sequence h=');
 >> nh=input('Enter the index of the second sequence nh=');

输出

代码语言:javascript
复制
 Enter the input sequence x =[1 2 3 4]
 Enter the index of the input sequence nx=[0 1 2 3]
 Enter the impulse response of the system,second sequence h=[5 6 7 8]
 Enter the index of the second sequence nh=[-2 -1 0 1]

计算卷积信号的索引

代码语言:javascript
复制
 >> % Index of the convolved signal
 >> n=min(nx)+min(nh):max(nx)+max(nh);

卷积计算

代码语言:javascript
复制
 >> y=conv(x,h);

显示

代码语言:javascript
复制
 >> disp('The convolved signal is:');
 >> y
 >> disp('The index of convolved sequence is:');
 >> n
 >> The convolved signal is:y =5    16    34    60    61    52    32
 >> The index of convolved sequence is:n =-2    -1     0     1     2     3     4

可视化

代码语言:javascript
复制
 >> subplot(311);
 >> stem(nx,x);
 >> subplot(312);
 >> stem(nh,h);
 >> subplot(313);
 >> stem(n,y);

时间序列信号的卷积

代码语言:javascript
复制
 >> clc;
 >> clear all;
 >> close all;
 >> t=-3:0.01:8;
 >> x=(t>=-1 & t<=1); % pulse that exists for t>=-1 and t<=1
 >> subplot(311);
 >> plot(t,x);
 >> h1=(t>=1 & t<=3); % pulse that exists for t>=1 & t<=3
 >> h2=(t>3 & t<=4); % pulse that exists for t>3 & t<=4
 >> h=h1+(2*h2);
 >> subplot(312);
 >> plot(t,h);
 >> y=convn(x,h);
 >> y=y/100;
 >> t1=2*min(t):0.01:2*max(t);
 >> subplot(313);
 >> plot(t1,y);

卷积的属性

卷积是一个线性算子,具有以下性质。

交换律

x[n] * h[n] = h[n] * x[n] ( in discrete time )

x(t) * h(t) = h(t) * x(t) ( in continuous time )

结合律

x[n] * (h1[n] * h2[n]) = (x[n] * h1[n]) * h2[n] ( in discrete time )

x(t) * (h1(t) * h2(t)) = (x(t) * h1(t)) * h2(t) ( in discrete time )

分配律

x[n] * (h1[n] + h2[n]) = (x[n] * h1[n]) + (x[n] * h2[n]) ( in discrete time )

x(t) * (h1(t) + h2(t)) = (x(t) * h1(t)) + (x(t) * h2(t)) ( in discrete time )

标量乘法结合律

a(f * g) = (af) * g

乘法单位

复共轭性

与微分的关系

与积分的关系

应用程序

卷积在许多领域得到了应用,包括数字图像处理、数字信号处理、光学、神经网络、数字数据处理、统计学、工程学、概率论、声学等等。

本文参与 腾讯云自媒体分享计划,分享自微信公众号。
原始发表:2020-05-25,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 DeepHub IMBA 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • 离散时间信号的卷积
  • 时间序列信号的卷积
  • 卷积的属性
  • 应用程序
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档