필터 지우기
필터 지우기

Guidance with DFT Transform

조회 수: 3 (최근 30일)
Moshe
Moshe 2016년 4월 29일
편집: Moshe 2016년 4월 30일
I need help with implement DFT transform i am attaching the function i should do the DFT. i need guidance and code example.
thanks a lot Moshe

답변 (2개)

Kevin
Kevin 2016년 4월 29일
f = 10; % 10 Hz.
t = (0:2047)/100; % 100 Hz sampling rate.
x = sin(2*pi*f*t);
X = fft(x);

Moshe
Moshe 2016년 4월 30일
편집: Moshe 2016년 4월 30일
First of all thanks for you quick answer. from your guidance i wrote this matlab code implement DFT. See source code:
f0=46.875;
W0=2*pi*f0;
Fs=1000;
T=1/Fs;
NFFT=512;
FFTperiod=NFFT*T;
t=(0:NFFT-1)*T;
str=['FFT period is ',num2str(FFTperiod), ' seconds'];
Freq=10*1/FFTperiod
strFreq =['Frequency is ', num2str(Freq), ' Hz'];
Freqbin =1/FFTperiod
strFreqbin =['FFT frequency bin is ',num2str(1/FFTperiod), ' Hz'];
strFreqNyquist =['FNyquist is ',num2str(1/FFTperiod*512), ' Hz'];
disp(str);
disp(strFreq);
disp(strFreqbin);
disp(strFreqNyquist);
x_t=sin(W0*t);
subplot(3,1,1)
plot(t,x_t);
title('time domain signal')
xlabel('Time')
ylabel('Amplitude')
Z=fft(x_t,NFFT)/NFFT;
f=Fs/2*linspace(0,1,NFFT/2);
subplot(3,1,2);
plot(f,abs(Z(1:NFFT/2)))
title('freq domain')
xlabel('Hz')
ylabel('Amplitude')
now i would like to add zero padding and plotting it to a graph and i am not success.
can some one advise me?

카테고리

Help CenterFile Exchange에서 Digital Filter Analysis에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by