Matlab中的多重卷积 [英] Multiple convolutions in Matlab

查看:395
本文介绍了Matlab中的多重卷积的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想用数值方法计算一些卷积,例如

I want to numerically calculate several convolutions like

其中 x y z w 函数在以下代码中给出:

where the x, y, z, w functions are given in the below code:

t = linspace(-100,100,10000);

x = t.*exp(-t.^2);
y = exp(-4*t.^2).*cos(t);
z = (t-2)/((t-2).^2+3^2);
w = exp(-3*t.^2).*exp(2i*t);

u = conv(conv(conv(x,y),z),w);

plot(t,u) % ??? - if we want to convolute N functions, what range should t span?

这是计算和绘制多个卷积的最有效方法吗?在数字上集成每个卷积的函数通常更好吗?

Is this the most efficient way to calculate and plot multiple convolutions? Is it generally better to numerically integrate the functions for each convolution?

编辑:

这是我卷积的实部图, u vs t

This is the plot of the real part of my convolution, u vs t:

下面的海报建议的方法(使用FFT)显示:

whereas the method (using FFTs) suggested by a poster below gives me:

是什么原因导致这种差异?

What causes this discrepancy?

推荐答案

如果信号长度较长,最好使用fft方法。

If the signal length is long, fft method would be better.

下面是一个示例。

t = linspace(-100,100,10000);

x = t.*exp(-t.^2);
y = exp(-4*t.^2).*cos(t);
z = (t-2)/((t-2).^2+3^2);
w = exp(-3*t.^2).*exp(2i*t);

L_x=fft(x);
L_y=fft(y);
L_z=fft(z);
L_w=fft(w);

L_u=L_x.*L_y.*L_z.*L_w; %convolution on frequency domain

u=ifft(L_u); 

figure(1)
plot(t,abs(u))
figure(2)
plot(t,real(u))
figure(3)
plot(t,imag(u))

这篇关于Matlab中的多重卷积的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆