Matlab 中的多重卷积
Multiple convolutions in Matlab
我想数值计算几个卷积像
其中 x
、y
、z
、w
函数在以下代码中给出:
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?
这是计算和绘制多重卷积的最有效方法吗?对每个卷积的函数进行数值积分通常会更好吗?
编辑:
这是我的卷积的实部图,u
vs t
:
而下面的海报建议的方法(使用 FFT)给了我:
造成这种差异的原因是什么?
如果信号长度较长,fft方法会更好
下面是一个例子。
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))
我想数值计算几个卷积像
其中 x
、y
、z
、w
函数在以下代码中给出:
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?
这是计算和绘制多重卷积的最有效方法吗?对每个卷积的函数进行数值积分通常会更好吗?
编辑:
这是我的卷积的实部图,u
vs t
:
而下面的海报建议的方法(使用 FFT)给了我:
造成这种差异的原因是什么?
如果信号长度较长,fft方法会更好
下面是一个例子。
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))