I am trying to simulate the sampling of a waveform to then apply FFT Analysis to it. Here is the sample code I have now using a square wave:
frequency =50;
sampleFrec = 1000;
period =1/frequency;
f=\[Piecewise] -1 (period/2)<=Mod[x,period]<period
1 True
testData=Table[N@f,{x,0,2*period,1/sampleFrec}];
Plot[f,{x,0,2*period}, PlotLabel->"Fundamental",ExclusionsStyle->Dashed, PlotStyle->{Thickness[0.006], Red}]
ListLinePlot[testData,PlotRange->Full, PlotLabel->"Fundamental"]
And this are the plots I'm getting, the first one is the 50Hz square wave I want but when I use Table[] and ListLinePlot[] I am not getting the same frequency, why? I am relatively new to Wolfram Mathematica so maybe this is something very stupid. Thank you for your help!

DataRange -> {0, 2*period}toListPlot. – Mr.Wizard Jun 25 '14 at 16:21Plot[]– Andres Jun 25 '14 at 16:27ListLinePlothas no way of knowing what range your data is supposed to cover, so it simply uses the number of data points as the range. – Mr.Wizard Jun 25 '14 at 16:31