在matlab中执行卷积

时间:2013-06-28 18:03:28

标签: matlab signal-processing fft convolution

好吧,所以我正在做一些信号处理,我的信号是宽度为83.66微米的狭缝和响应函数的卷积。我想使用傅里叶变换的卷积属性来找到响应。我使用的代码如下:

num=xlsread('Data.xlsx','B2:C13');
y=num(13:end);
x=num(1:12);
width = 83.66;
p = width*sqrt(1/(2*pi))*sinc((x)*(width/2));
slit = abs(fftshift(ifft(p)));

figure
subplot(5,1,1);plot(x,y);title('imported data')
subplot(5,1,2);plot(x,p);title('transformed slit')
subplot(5,1,3);plot(x,slit);title('slit')

u = abs(fftshift(ifft(y)));
l = u./p;
response = abs(fftshift(fft(l)));

subplot(5,1,4);plot(x,response);title('response')

%Data Check
check = conv(slit,response,'full');
z = linspace(min(x),max(x),length(check));
subplot(5,1,5);plot(z,check./2);title('check')

x =

  

-344.0000 -275.2000 -206.4000 -137.6000 -68.8000 0

     

第7至12栏

     

68.8000 137.6000 206.4000 275.2000 344.0000 412.8000

和y =

Columns 1 through 5

       13771       12478       19443       69392      143737

  Columns 6 through 10

      189278      184486      188466      185023      128133

  Columns 11 through 12

       51288       10854

所以我所做的就是输入信号,执行fft。然后我除以sinc函数(一个狭缝的FT),然后将所有这些分开。当我用我的缝隙重新调整我的反应时,两者是不一样的。

任何想法或任何我明显错误的事情?

0 个答案:

没有答案