1D卷积入门:一维卷积是如何处理数字信号的
作者:互联网
卷积是在科学、工程和数学中应用最广泛的运算符之一
卷积是对两个函数(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的元素相乘,然后对角相加。
>> clc; % clears the command window
>> clear all; % clears all the variables in the workspace
>> close all; % closes all the figure window
从用户那里获取输入
>> % 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=');
输出
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]
计算卷积信号的索引
>> % Index of the convolved signal
>> n=min(nx)+min(nh):max(nx)+max(nh);
卷积计算
>> y=conv(x,h);
显示
>> 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
可视化
>> subplot(311);
>> stem(nx,x);
>> subplot(312);
>> stem(nh,h);
>> subplot(313);
>> stem(n,y);
时间序列信号的卷积
>> 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
乘法单位
复共轭性
与微分的关系
与积分的关系
应用程序
卷积在许多领域得到了应用,包括数字图像处理、数字信号处理、光学、神经网络、数字数据处理、统计学、工程学、概率论、声学等等。
作者:Sinchana S R
标签:sequence,卷积,h1,数字信号,h2,1D,Enter,input 来源: https://blog.csdn.net/m0_46510245/article/details/106326365