I need to change the frequency domain of a DFT

1 view (last 30 days)
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

Accepted Answer

Matt J
Matt J on 18 Jan 2022
stem(2*pi*f,abs(shx),'r')

More Answers (0)

Tags

Community Treasure Hunt

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

Start Hunting!