to perform DFT on a simple sine wave

Status
Not open for further replies.

ajayreddybireddy

Newbie level 5
Joined
Mar 19, 2008
Messages
10
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,343
hello,

anybody please help me
how to perform DFT on a sine wave of freq about 1000hz, without using MATLAB FFT function.

please help me
I am new to MATLAB!!!
 

You can write the algorithm; the DFT equation which is:

X(W) = x(0)*exp(-j*0*W)+ x(1)*exp(-j*1*W)+..... untill N-1 where N is the number of samples after which the spectrum is periodic (sampling frequency). In this case you'll take only two time samples one of them is zero valued that result having an impulse at frequency of 1000 Hz.
 
thank you Sir,

from provided equation I can't do the implementation.

Sin(2*pi*1000*t); sampling freq=4000, is the sine wave on which I am trying to implement DFT equation without applying FFT matlab function.


can you please provide me the concerned code.

please Sir....
 

check mathworks website (MATLAB central), I don't have a code currently.
 

anyway I got solution for this..
just see the below code


N=400;
n=0:N-1;
f1=1000;
fs1=8000;
x=sin(2*pi*(f1/fs1)*n);
y=fft(x);
z=abs;
for k=0:N-1
for n=0:N-1
X(n+1)=x(n+1)*exp(-j*2*pi*k*n/N);
end
Xk(k+1)=sum(X);
end
Xk
l=abs(Xk);
subplot(3,1,1);
plot(l);
subplot(3,1,3);
plot(z);
title('using fft function')
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…