I found the solution, I didn't post the frequency of sampling. But apparently fftshift just swaps X axis and then if there were no 0 between samples they get joined. So I had to add zeroes to the fft result in order for the fftshift to work properly, this is by extending the sampled rate of the original function. (Making sampling frequency higher extends repeating time in frequency domain vice versa making sampled range larger adds samples to the frequency domain in between the existing samples.)
fftshift isn't workig
9 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Vitali Pomanitski
il 8 Lug 2020
Risposto: Vitali Pomanitski
il 10 Lug 2020
Hi,
I successfully got two deltas on 4/10 and on 2/10, but I cannot center the graph.
Could you help me?
t = 0:(1/fs):(10-1/fs);
S = 2*cos(3*pi*t/10).*cos(pi*t/10); %cos(4pit/10)+cos(2pit/10)
n = length(S);
X = fft(S);
f = (0:n-1)*(fs/n)*2; %multiply by pi*2, leave the pi aside
f80 = (0:n-1);
power = abs(X).^2/n;
stem(f,power)
Y = fftshift(X)
fshift = (-n/2:n/2-1)*(fs/n)
powershift = abs(Y).^2/n;
plot(fshift,powershift)
I attached pictures. In the second graph those are not even deltas.
0 Commenti
Risposta accettata
Più risposte (0)
Vedere anche
Categorie
Scopri di più su Fourier Analysis and Filtering in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!