Hello. Im studying discrete fourier transform and for that I want to implement it. I mean, this is the code I made but there is a problem
I defined a little discrete signal, x. And I calculate the DFT and then the inverse DFT but I dont get the same signal.
What Im doing wrong?
Thanks in advance.
x=[0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 -0.1 -0.2 -0.3 -0.4 -0.5 -0.6 -0.7 -0.8 -0.9 -1 -0.9 -0.8 -0.7 -0.6 -0.5 -0.4 -0.3 -0.2 -0.1] sum=0for k=1:40 for j=1:40 sum= sum+x(j)*exp(- 1i * 2 * pi * (1/20)*(j-1)*(k-1)) end a(k)=sum sum=0 endn=1:1:40 sum=0for k=1:40 for j=1:40 sum= sum+a(j)*exp( 1i * 2 * pi * (1/20)*(j)*(k)) end b(k)=(1/40)*sum sum=0 endsubplot(1,2,1)plot(n, x)subplot(1,2,2)plot(n,b)
Best Answer