DFT of sine wave
9 ビュー (過去 30 日間)
古いコメントを表示
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 件のコメント
Sindar
2020 年 4 月 30 日
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?
回答 (1 件)
Raunak Gupta
2020 年 5 月 3 日
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 件のコメント
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!