필터 지우기
필터 지우기

How to verify the discrete-time convolution theorem with Matlab

조회 수: 11 (최근 30일)
moyu
moyu 2023년 6월 4일
편집: Harsh Kumar 2023년 6월 8일
My idea is to first get the time-domain convolution result of the output signal y1, and then perform fft on it to get the y1_f spectrum. Then I get the spectrum x1_f of the input signal and the frequency response h1_f, the product of the two should be equal to y1_f. But the results I get are very unsatisfactory.The picture is as follows:

답변 (2개)

Harsh Kumar
Harsh Kumar 2023년 6월 4일
편집: Harsh Kumar 2023년 6월 8일
Hi moyu,
As per my understanding ,you are using two different methods to determine the Fast Fourier Transform of a function but it does not gave the same results .
The potential cause of the mismatch of above results is the missing "scaling" factor when you are calculating x1_f from h1_f x y1_f. In FT the multiplication property states that ,
FT (x(t)∗y(t)) ⟷ (1/2π) X(ω).Y(ω)
Here 1/2π is the scaling factor which is 1/N in case of DTFT/fft .
So,
The correct equation may be rewritten as :
x1_f= 1/N* h1_f * y1_f where * is simple multiplication not convolution operator.
  댓글 수: 1
moyu
moyu 2023년 6월 5일
Thanks! I just find out that the wrong result is indeed caused by the sacling factor. However I want to verify that the discretetime Fourier transform of convolution of two sequences in time domain is equivalent to multiplication of their discrete-time Fourier transforms. In this case, scaling factor should be '1' instead of '1/2π' or '1/N'.

댓글을 달려면 로그인하십시오.


Paul
Paul 2023년 6월 4일
Hi moyu,
Linear convolution in the frequency domain using fft requires zero padding the sequences before taking the FFTs and multiplying. If the sequences are each of length N, the FFTs should be zero padded to at least 2*N-1. Here's an example.
N = 10;
rng(100)
x1 = rand(1,N);
h1 = rand(1,N);
y1 = conv(x1,h1);
x1fft = fft(x1,2*N-1);
h1fft = fft(h1,2*N-1);
y1f = ifft(x1fft.*h1fft);
% verify that y1 and y1f are "the same"
max(abs(y1-y1f))
ans = 4.4409e-16
  댓글 수: 3
Paul
Paul 2023년 6월 5일
The factor of 2/N was incorrect as well. As you can see in the correct code, linear convolution is achieved by zero padding the FFTs to an appropriate length AND not using any scale factors on the FFTs, as computed by Matlab's implementation of fft.
"I want to get the true spectrum of the signal, "
Not sure what "true spectrum" means in this context, nor which signal is being referenced. In any event, I thought the question was about convolution. Is the desire to get the true spectrum a new part of the problem?
moyu
moyu 2023년 6월 5일
Sorry, my statement is not accurate. What I need is the accurate amplitude of the spectrum, So I multiply the factor(You can see details in 'https://dsp.stackexchange.com/questions/48049/understanding-where-the-constant-2-n-comes-from-in-fourier-transformation'). Of course not using any scale factors on the FFTs is also right.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by