Plot signal of DFT without using FFT function
Afficher commentaires plus anciens
I looked at so many blogs until I came here and still can't figure it out.
I have a signal given as:
The DFT of that signal is:
The analytical solution for fk is:

Where fk = 100 when k = 67 and 0 otherwise.
Here's what I have:
clc;clear;
N = 715;
k = 0:N-1;
n = k;
fj_func = @(N,n) (100*exp(2i.*pi.*67/N.*k)).*(n>=0 & n<=N-1);
fj = fj_func(N,n);
fk_func = @(N,k) (1/N).*fj.*(exp(-2i.*pi.*k.*n./N)).*(k>=0 & k<=N-1);
fk = fk_func(N,k);
stem(k,abs(fk)/N)
When I use the analytical solution above, I get:
clc;clear;
N = 715;
k = 0:N-1;
n = k;
fk_func = @(k) (100/N).*((1-exp(2i.*pi.*n.*(67-k)))./(1-exp(2i.*pi.*n.*(67-k)./N)));
fk = fk_func(k);
stem(k,abs(fk)/N)
I used the fft function for fj, and it works. My value is at
clc;clear;
N = 715;
k = 0:N-1;
n = k;
fj_func = @(N,k) (100*exp(2i.*pi.*67/N.*k)).*(k>=0 & k<=N-1);
fj = fj_func(N,k);
ft = fft(fj);
stem(k,abs(ft)/N)
I'm not sure what I'm doing wrong. Any ideas would be greatly appreciated. Thanks
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Transforms dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!




