MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi
Learn moreOpportunities for recent engineering grads.
Apply TodayMATLAB Central > MATLAB Newsreader > fft on square wave 

I want to compute the fourier coefficients of a square wave with height 1 and length 1 . According to the real fourier transform, the result should be F(z)=sin(pi*z)/(pi*z). This means the maximum value should be 1. 
On May 10, 8:43 am, "Tomas " <tomas...@gmail.com> wrote: 
> Can't you work it out? 
On May 10, 9:45 am, "Tomas " <tomas...@gmail.com> wrote: 
"Tomas " <tomasnic@gmail.com> wrote in message <gu4psl$oi$1@fred.mathworks.com>... 
> The fft does NOT approximate the Fourier Transform until you multiply it by your sampling interval. Remember, the continuous fourier transform is an integral while the DFT is a sum. 
"Tomas " <tomasnic@gmail.com> wrote in message <gu6a01$5hq$1@fred.mathworks.com>... 
On May 9, 4:43 pm, "Tomas " <tomas...@gmail.com> wrote: 
I didn?t know the heaviside was not a native function. Here is an equal implementation of the square function: 
"Tomas " <tomasnic@gmail.com> wrote in message <gu76fb$qv$1@fred.mathworks.com>... 
"Tomas " <tomasnic@gmail.com> wrote in message <gu6a01$5hq$1@fred.mathworks.com>... 
I found out the reason of the Nan. It?s because of the implementation of the heaviside function I used: 
"Tomas " <tomasnic@gmail.com> wrote in message <gu8k5s$knf$1@fred.mathworks.com>... 
On May 9, 4:43 pm, "Tomas " <tomas...@gmail.com> wrote: 
On May 11, 3:30 am, "Tomas " <tomas...@gmail.com> wrote: 
Thanks a lot for your explanation and the program, Greg! I now fully understand what went wrong. 
Greg Heath <heath@alumni.brown.edu> wrote in message <530b5762c7ff43c5bd95a10c347355bd@t11g2000vbc.googlegroups.com>... 
Ciao I am new here. 
Dragon_Maja <marijavukicevic1@gmail.com> wrote in message <e786153c8af84b188eb18fbecd574c35@q14g2000vbn.googlegroups.com>... 
Subject: fft on square wave From: Carlos Adrian Vargas Aguilera Date: 24 Jun, 2009 21:44:01 Message: 20 of 21 
WHAT A MESS! 
Subject: fft on square wave From: Carlos Adrian Vargas Aguilera Date: 24 Jun, 2009 22:45:03 Message: 21 of 21 
DT = 2*tmax/100; 
A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.
Anyone can tag a thread. Tags are public and visible to everyone.