Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.
I modify code that get sample of sinwave 50 Hz as below :
for(i = 0;i<sampleN;i++){
temp = 1/((double)sigF*sampleN);
sampletime = (double)i*temp;
ADCsample[i] = sin((double)2*pi*sigF*sampletime);
}
and define Fsample must equal 1/((1/sigF)/N).example with signalF = 50Hz then...
Sorry Frequncy F is 24Hz.Why with sigF = Fsamle/2,all valules of vector ADCsample is zero?I debuged and is not zero.Theoretically of Nyquist Fsample = sigF*2.With ADCsample is sampled at 200hz frequency above,then F result after DFT must 200hz instead 24hz.
I still this code has problem when fixed:
for (n=0; n<(N/2); n++) // Search for peak
{ ...
result after fixed and redefine
#define Fsample 400 //sample frequency
#define sigF 200 //signal frequency
#define sampleN 100 // sample number
Result of Frequency is 24Mhz...
#include <stdio.h>
#include <math.h>
#define pi 4.*atan(1.)
I tested with code C below,I see with Fsample 100 is right with result F = 50 Hz but when replace Fsample 200 ,result F = 153 is wrong.I think this code not right.
#define Fsample 100 //sample frequency
#define sigF 50...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.