I need to change the frequency domain of a DFT

1 visualización (últimos 30 días)
Juan Pablo Ruiz Florez
Juan Pablo Ruiz Florez el 18 de En. de 2022
Comentada: Juan Pablo Ruiz Florez el 18 de En. de 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

Respuesta aceptada

Matt J
Matt J el 18 de En. de 2022
stem(2*pi*f,abs(shx),'r')

Más respuestas (0)

Categorías

Más información sobre Spectral Measurements en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

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

Start Hunting!

Translated by