I want to determine the magnitude and phase of 100kHz Sinusoidal in a given signal when the sampling rate is 15MHz and when the signal has 32768 samples.

8 次查看(过去 30 天)
the code I used is as follows. Around 100kHz. Phase changes from 160 degrees (@99.79kHz) to -18 degrees (@101.2kHz). How can I adjust settings to correctly add 100kHz frequency point instead of 99.79kHz and 101.2kHz?
FFT_V_in = 2*fft(DAQSig(2,:))/n;
FFT_V_in_mag = (abs(FFT_V_in));
FFT_V_in_phase = angle(FFT_V_in);
fs=15000000
f = (0:n-1)*fs/n;
subplot(2,1,1)
plot(f,1000*FFT_V_in_mag)
ylabel('V_{in} (mV)')
ytickformat('%.2f')
title('Magnitude')
subplot(2,1,2)
plot(f,FFT_V_in_phase*180/pi)
ytickformat('%.2f')
ylabel('V_{in} (degree)')
title('Phase')
The output is as follows

采纳的回答

Aquatris
Aquatris 2018-7-19
编辑:Aquatris 2018-7-19
When you do an FFT, you basically assign magnitudes to each frequency. The frequency points are usually called bins and are determined by your sampling frequency and length of your signal. For instance, if your sampling frequency is 1000 Hz and you have 5000 samples, then the frequencies in the fft will be integer multiples of 1000/5000 = 0.2 Hz.
So to answer your question, if you were to adjust your Fs/N ratio (sampling rate/ length of the signal) to be 1, 0.1,10,100, you will get 100 Hz in your data instead of 99.76 Hz. This is most easily done by adjusting the length of your data rather than changing the sampling frequency.
For your data, you can use the first 30000 samples instead of 32768 and it should give you what you need (data at every 500 Hz, including 100 kHz).
  4 个评论
Aquatris
Aquatris 2018-7-19
编辑:Aquatris 2018-7-19
Yes, it basically truncates the data (if data has more than n samples) so that data only has n samples.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Multirate Signal Processing 的更多信息

产品


版本

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by