DFT of sine wave
9 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hello,
I have to calculate the DFT of the following signals sampled at 32 kHz. Plot the magnitude, phase, real and imaginary parts of the DFT coefficients.
I know that to generate plots I have to use these functions: abs, angle, real, imag
I really could use some help.
The given signal is: x = sin(2pi*8000*t + pi/8), signal length: 8 samples
I am able to create function that would be without that 'pi/8' part, no idea how to add this to my function :/ ..
As far as I am concerned, the function without my problem looks like:
n=8
fs=32000
fsin=8000
A=1
df=(2*pi)
k=0: n-1;
x=A*sin((2*pi)*fsin.*k/fs + df);
X=fft(x);
fr=k*fs/n;
figure
subplot(312)
stem(fr, real(X))
title("real");
subplot(311)
stem(fr, imag(X))
title("imaginary")
But unfortunately I have no idea how to add the pi/8 part..
Thanks in advance for every hint..
1 comentario
Sindar
el 30 de Abr. de 2020
It looks like you have added the pi/8, what's the problem? Are you trying to write an analytic expression for the fourier components?
Respuestas (1)
Raunak Gupta
el 3 de Mayo de 2020
Hi,
It looks like ‘df’ in the above code can be set to ‘pi/8’ to represent time shift in original signal. Other than that everything looks fine.
0 comentarios
Ver también
Categorías
Más información sobre Discrete Fourier and Cosine Transforms en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!