I need to change the frequency domain of a DFT
1 view (last 30 days)
Show older comments
Juan Pablo Ruiz Florez
on 18 Jan 2022
Commented: Juan Pablo Ruiz Florez
on 18 Jan 2022
I have to change f from (-0.5, 0.5 ) to (-pi, pi).
n=64;
k = 0:n-1;
O1=(10*2*pi)/n;
O2=(14*2*pi)/n;
x = cos(O1*k) + 0.5*cos(O2*k);
hx=fft(x);
shx=fftshift(hx);
f=[-n/2:n/2-1]/n;
figure(1)
stem(f,abs(shx),'r')
xline(O1,':');
xline(O2,':');
xline(-O1,':');
xline(-O2,':');
xlabel('Frequency in [-\pi,\pi]')
ylabel('Magnitude of DFT(x)')
axis([-pi pi 0 inf]);
grid
Thank you very much
0 Comments
Accepted Answer
More Answers (0)
See Also
Categories
Find more on Spectral Measurements in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!