How to multiply 2 fft's with different lengths?
6 次查看(过去 30 天)
显示 更早的评论
I want to find the output signal(y) from input signal(x) and impulse response(h). To do that first I take the fft of both x and h, then multply them, and finally taking the ifft of the result. The input signal is a 5 second sound. I tried to equalize the lengths of the FFTs but it didnt work. How can I overcome this?
[x,Fs]=audioread('hello.wav');
T=1/Fs;
L=220500;%length of the original sound
d=8820;%delay in terms of samples
a=0.8;%attenuation coefficient
h = [1 zeros(1,d-1) a];%impulse response h(n)
X=fft(x);
h1 =[h; zeros(length(x)-length(h),1)];
H=fft(h1);
Y=H.*X;
y=ifft(Y);
0 个评论
回答(1 个)
Paul Hoffrichter
2021-5-27
Is this your desired effect?
[x,Fs]=audioread('hello.wav');
sound(x,Fs);
T=1/Fs;
disp('Wait for music to complete')
pause( length(x)*T + 1);
L=length(x); % 220500;%length of the original sound
d=8820;%delay in terms of samples
a=0.8;%attenuation coefficient
h = [1 zeros(1,d-1) a];%impulse response h(n)
X=fft(x);
h1 =[h(:); zeros(length(x)-length(h),1)];
H=fft(h1);
Y=H.*X;
y=ifft(Y);
sound(y,Fs);
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Measurements and Spatial Audio 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!