I need to change the frequency domain of a DFT

조회 수: 1 (최근 30일)
Juan Pablo Ruiz Florez
Juan Pablo Ruiz Florez 2022년 1월 18일
댓글: Juan Pablo Ruiz Florez 2022년 1월 18일
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

채택된 답변

Matt J
Matt J 2022년 1월 18일
stem(2*pi*f,abs(shx),'r')

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Spectral Measurements에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by