DSPRelated.com
Forums

FFT graphing help

Started by phenommsu1 March 26, 2008
Hello all.  I am working on a problem for class that is taking some time
data and changing it to frequency data.  I am using excel and the fast
fourier transform(fft).

I am having a problem graphing the results.  I am very new to signal
processing.

I am only given the data which is 1024 points long.
I will only ask for help with one because if I figure this one out I can
do the rest.

The period is .117.  Making the sampline rate 1/.117.

I have the two columns of data here is an example.
The first column is (1*(1/.117)/1024) and the second is the fft values.  

pres43	             abs imag
0.006643282	162509.4667
0.013286565	388.025981
0.019929847	600.4277992
0.026573129	499.1078937
0.033216412	447.4588355
0.039859694	102.7576392
0.046502976	276.7567742
0.053146259	358.0531147
0.059789541	289.5977569
0.066432823	129.8177899
0.073076105	91.85556182
0.079719388	250.3116294
0.08636267	35.77585877
0.093005952	218.271273
0.099649235	216.1229107
0.106292517	215.5078932
0.112935799	110.6895935
0.119579082	153.2837982
0.126222364	194.9400366
0.132865646	96.83955867

My problems is that I don't know how to graph the values correctly.  The
graph as it stands is not righ. Someone told me that I have to remove the
DC zero values? I do not know how to do that and that is why I am asking
for help.


phenommsu1 wrote:

> Hello all. I am working on a problem for class that is taking some time > data and changing it to frequency data. I am using excel and the fast > fourier transform(fft). > > I am having a problem graphing the results. I am very new to signal > processing. > > I am only given the data which is 1024 points long. > I will only ask for help with one because if I figure this one out I can > do the rest. > > The period is .117. Making the sampline rate 1/.117. > > I have the two columns of data here is an example. > The first column is (1*(1/.117)/1024) and the second is the fft values. >
[SNIP DATA SAMPLE]
> > My problems is that I don't know how to graph the values correctly. The > graph as it stands is not righ.
Describe what you think is "not right" with the graph.
> Someone told me that I have to remove the > DC zero values? I do not know how to do that and that is why I am asking > for help. >
Due to how you phrased that sentence, I'm not sure which of two things you were being told to do. But think about what that large value in the first bin indicates. I think you're closer to the answer that you think. You just have to ask yourself the right question ;)
>phenommsu1 wrote: >
>[SNIP DATA SAMPLE] >> >> My problems is that I don't know how to graph the values correctly.
The
>> graph as it stands is not righ. > >Describe what you think is "not right" with the graph. > > >> Someone told me that I have to remove the >> DC zero values? I do not know how to do that and that is why I am
asking
>> for help. >> > >Due to how you phrased that sentence, I'm not sure which of two things >you were being told to do. But think about what that large value in the >first bin indicates. > >I think you're closer to the answer that you think. You just have to ask
>yourself the right question ;) > > >1. Well I know the fft graph has is not correct because it contains
values that should not be present. 2. I do not know how to remove those values. 3. I tried to subtract the avg of the entire sample from each data point before fft. Then I did the fft, but I still had the same problem. 4. I do not know what the large value in the first bin indicates. I thought the meaning was that I needed to do number 3. So I am not sure about the question I should be asking. Should I be working with the data before the fft or after the fft is applied. Thanks
Any help will be greatly appreciated.  

Thanks.
On Mar 26, 12:15 pm, "phenommsu1" <green...@gmail.com> wrote:
> Any help will be greatly appreciated. > > Thanks.
Can you clarify the dimensions of the values you gave for sample rate, period, and data index? Is the data periodic? If so, around what index does it appear to start to repeat? What is your formula for "abs imag"?
Let's start over again ;)
[which is why I top post rather than bottom posting]

*** What does the value in the first bin of a FFT (ANY FFT) represent?

When plotting the FFT you say "The graph as it stands is not right."
When ask ho it is not right, you reply "Well I know the fft graph has is 
not correct because it contains values that should not be present."


*** Why shouldn't those values be present?


Two background questions:
1. What is course you taking? [will help group to phrase responses to 
thought pattern you are used to]
2. Why are you using Excel?


P.S.
As it is only 1024 points, send me an email with your input data 
attached. Then I can ask you specific leading questions.





phenommsu1 wrote:
> Hello all. I am working on a problem for class that is taking some time > data and changing it to frequency data. I am using excel and the fast > fourier transform(fft). > > I am having a problem graphing the results. I am very new to signal > processing. > > I am only given the data which is 1024 points long. > I will only ask for help with one because if I figure this one out I can > do the rest. > > The period is .117. Making the sampline rate 1/.117. > > I have the two columns of data here is an example. > The first column is (1*(1/.117)/1024) and the second is the fft values. > > pres43 abs imag > 0.006643282 162509.4667 > 0.013286565 388.025981 > 0.019929847 600.4277992 > 0.026573129 499.1078937 > 0.033216412 447.4588355 > 0.039859694 102.7576392 > 0.046502976 276.7567742 > 0.053146259 358.0531147 > 0.059789541 289.5977569 > 0.066432823 129.8177899 > 0.073076105 91.85556182 > 0.079719388 250.3116294 > 0.08636267 35.77585877 > 0.093005952 218.271273 > 0.099649235 216.1229107 > 0.106292517 215.5078932 > 0.112935799 110.6895935 > 0.119579082 153.2837982 > 0.126222364 194.9400366 > 0.132865646 96.83955867 > > My problems is that I don't know how to graph the values correctly. The > graph as it stands is not righ. Someone told me that I have to remove the > DC zero values? I do not know how to do that and that is why I am asking > for help. > >
The first bin is the DC component.  Correct?
The values should not be present because they should be zero values,
because they represent gaps in the frequency reading.

I am using excel because that is what we were assigned to use. It is for
intro to biomedical signal processing.   

I dont know how to send you an attachment, the site only gives your name
if for me to send and email not an attachment. But I can post a snip of
the data here.  25 points.

OriginalSig	fft	                                abs imag
162.5666667	162509.466666667	                162509.4667
161	        -140.639883835191-361.641514463957i	388.025981
159.9666667	-587.357541210861+124.597997153187i	600.4277992
160.4333333	112.744714041656+486.207074200488i	499.1078937
160	        193.456405302228+403.477420379003i	447.4588355
159.2666667	32.6729605560732+97.4248945004916i	102.7576392
160.3333333	172.213820584924+216.64882199081i	276.7567742
159.5666667	357.313870260752+22.9963279562987i	358.0531147
159.8333333	105.925098369729+269.530581400113i	289.5977569
159.0666667	65.9363307465512-111.82602050226i	129.8177899
159.2666667	-54.7662602027889+73.7434809308128i	91.85556182
159.1666667	88.055966666471+234.311883025187i	250.3116294
158.0666667	30.7528486227951+18.28043686791i	35.77585877
156.9	        211.105579685004+55.4687555965784i	218.271273
158.4	        -204.1981590865-70.7970646786261i	216.1229107
158.3	        -188.027542697669-105.305722630798i	215.5078932
158.2666667	105.5446891243+33.3542306635607i	110.6895935
158.3666667	78.3394011973472-131.753030358915i	153.2837982
157.4666667	56.547484874658-186.558301359245i	194.9400366
157.2	       -84.5708197139807+47.1770768187416i	96.83955867
156.9666667	-49.5335241663969-89.6174641256261i	102.3956049
157.2666667	-83.8826534062392+30.7721614046116i	89.34889736
156.3333333	22.4687435767936+90.7586387084729i	93.49852907
156.0333333	113.448294114525-65.8047049245391i	131.1517237
157.7666667	69.5965604037754-180.19293709252i	193.166187

The first column is the original signal in the time domain from 1-25.  The
second column is the fft of the first. The third column is the abs value of
the fft values.  I feel like I am close to understanding, but I am missing
something, so thank you very much for your help.




>Let's start over again ;) >[which is why I top post rather than bottom posting] > >*** What does the value in the first bin of a FFT (ANY FFT) represent? > >When plotting the FFT you say "The graph as it stands is not right." >When ask ho it is not right, you reply "Well I know the fft graph has is
>not correct because it contains values that should not be present." > > >*** Why shouldn't those values be present? > > >Two background questions: >1. What is course you taking? [will help group to phrase responses to >thought pattern you are used to] >2. Why are you using Excel? > > >P.S. >As it is only 1024 points, send me an email with your input data >attached. Then I can ask you specific leading questions. > > > > > >phenommsu1 wrote: >> Hello all. I am working on a problem for class that is taking some
time
>> data and changing it to frequency data. I am using excel and the fast >> fourier transform(fft). >> >> I am having a problem graphing the results. I am very new to signal >> processing. >> >> I am only given the data which is 1024 points long. >> I will only ask for help with one because if I figure this one out I
can
>> do the rest. >> >> The period is .117. Making the sampline rate 1/.117. >> >> I have the two columns of data here is an example. >> The first column is (1*(1/.117)/1024) and the second is the fft values.
>> >> pres43 abs imag >> 0.006643282 162509.4667 >> 0.013286565 388.025981 >> 0.019929847 600.4277992 >> 0.026573129 499.1078937 >> 0.033216412 447.4588355 >> 0.039859694 102.7576392 >> 0.046502976 276.7567742 >> 0.053146259 358.0531147 >> 0.059789541 289.5977569 >> 0.066432823 129.8177899 >> 0.073076105 91.85556182 >> 0.079719388 250.3116294 >> 0.08636267 35.77585877 >> 0.093005952 218.271273 >> 0.099649235 216.1229107 >> 0.106292517 215.5078932 >> 0.112935799 110.6895935 >> 0.119579082 153.2837982 >> 0.126222364 194.9400366 >> 0.132865646 96.83955867 >> >> My problems is that I don't know how to graph the values correctly.
The
>> graph as it stands is not righ. Someone told me that I have to remove
the
>> DC zero values? I do not know how to do that and that is why I am
asking
>> for help. >> >> >
I am going to try to post the data again without adjusting it in the text
box.  Maybe that will allow it to be seen better. :)

PRES43	fft	abs imag
162.5666667	162509.466666667	162509.4667
161	-140.639883835191-361.641514463957i	388.025981
159.9666667	-587.357541210861+124.597997153187i	600.4277992
160.4333333	112.744714041656+486.207074200488i	499.1078937
160	193.456405302228+403.477420379003i	447.4588355
159.2666667	32.6729605560732+97.4248945004916i	102.7576392
160.3333333	172.213820584924+216.64882199081i	276.7567742
159.5666667	357.313870260752+22.9963279562987i	358.0531147
159.8333333	105.925098369729+269.530581400113i	289.5977569
159.0666667	65.9363307465512-111.82602050226i	129.8177899
159.2666667	-54.7662602027889+73.7434809308128i	91.85556182
159.1666667	88.055966666471+234.311883025187i	250.3116294
158.0666667	30.7528486227951+18.28043686791i	35.77585877
156.9	211.105579685004+55.4687555965784i	218.271273
158.4	-204.1981590865-70.7970646786261i	216.1229107
158.3	-188.027542697669-105.305722630798i	215.5078932
158.2666667	105.5446891243+33.3542306635607i	110.6895935
158.3666667	78.3394011973472-131.753030358915i	153.2837982
157.4666667	56.547484874658-186.558301359245i	194.9400366
157.2	-84.5708197139807+47.1770768187416i	96.83955867
156.9666667	-49.5335241663969-89.6174641256261i	102.3956049
157.2666667	-83.8826534062392+30.7721614046116i	89.34889736
156.3333333	22.4687435767936+90.7586387084729i	93.49852907
156.0333333	113.448294114525-65.8047049245391i	131.1517237
157.7666667	69.5965604037754-180.19293709252i	193.166187

phenommsu1 wrote:
[but he top posted following my example which he shouldn't have ;]
[I reorganized and did judicious snipping so we can be conventional and 
bottom post for the rest of the thread]

 > Richard Owlett wrote:
 >>Let's start over again ;)
 >>[which is why I top post rather than bottom posting]
 >>
 >>*** What does the value in the first bin of a FFT (ANY FFT) represent?
 >>
 >>When plotting the FFT you say "The graph as it stands is not right."
 >>When ask ho it is not right, you reply "Well I know the fft graph is>
 >>not correct because it contains values that should not be present."
 >>
 >>
 >>*** Why shouldn't those values be present?
 >>
 >>
 >>Two background questions:
 >>1. What is course you taking? [will help group to phrase responses to
 >>thought pattern you are used to]
 >>2. Why are you using Excel?
 >>
 >>

> The first bin is the DC component. Correct?
Yes. And that answer tells you what first thing you MIGHT want to do to your data. I emphasize *MIGHT* at this point because its not strictly necessary but I suspect it will give you more of what you _expect_ to see. [Raises a side question. Was your input data given to you as a problem set or were you doing a laboratory assignment?] In any case, what you should do is FFT {signal - average of signal}.
> The values should not be present because they should be zero values, > because they represent gaps in the frequency reading.
Actually they do "belong" there. The keyword is "windowing". Start with Section 9.1 of _The Scientist and Engineer's Guide to Digital Signal Processing_ by Steven W. Smith ( http://www.dspguide.com/ch9/1.htm ) I've got links to more references somewhere, but that will get you started in right direction.
> > I am using excel because that is what we were assigned to use.
Ok, that tells me something about immediate goals of the course. > It is for intro to biomedical signal processing. Now that takes me back to days before DSP existed. As an undergrad EE student I worked as a tech for Veterinary Physiology and later as Instrumentation Tech for the university's Chemistry Department. The "real world" vs "theory" ;) Is any course specific information posted on the WEB?
> > I dont know how to send you an attachment, the site only gives your name > if for me to send and email not an attachment. But I can post a snip of > the data here. 25 points.
I thought the attachment would be simple. For future reference "large" pieces of data should be sent as attachments. In this case send me the "OriginalSig" only in the body of an email. You've obviously picked up the idea of not posting large amounts of data on a newsgroup. [large snip - including sample of data]
On Mar 27, 6:55 am, "phenommsu1" <green...@gmail.com> wrote:
> The first bin is the DC component. Correct? > The values should not be present because they should be zero values, > because they represent gaps in the frequency reading. > > I am using excel because that is what we were assigned to use. It is for > intro to biomedical signal processing. > > I dont know how to send you an attachment, the site only gives your name > if for me to send and email not an attachment. But I can post a snip of > the data here. 25 points. > > OriginalSig fft abs imag > 162.5666667 162509.466666667 162509.4667 > 161 -140.639883835191-361.641514463957i 388.025981 > 159.9666667 -587.357541210861+124.597997153187i 600.4277992 > 160.4333333 112.744714041656+486.207074200488i 499.1078937 > 160 193.456405302228+403.477420379003i 447.4588355 > 159.2666667 32.6729605560732+97.4248945004916i 102.7576392 > 160.3333333 172.213820584924+216.64882199081i 276.7567742 > 159.5666667 357.313870260752+22.9963279562987i 358.0531147 > 159.8333333 105.925098369729+269.530581400113i 289.5977569 > 159.0666667 65.9363307465512-111.82602050226i 129.8177899 > 159.2666667 -54.7662602027889+73.7434809308128i 91.85556182 > 159.1666667 88.055966666471+234.311883025187i 250.3116294 > 158.0666667 30.7528486227951+18.28043686791i 35.77585877 > 156.9 211.105579685004+55.4687555965784i 218.271273 > 158.4 -204.1981590865-70.7970646786261i 216.1229107 > 158.3 -188.027542697669-105.305722630798i 215.5078932 > 158.2666667 105.5446891243+33.3542306635607i 110.6895935 > 158.3666667 78.3394011973472-131.753030358915i 153.2837982 > 157.4666667 56.547484874658-186.558301359245i 194.9400366 > 157.2 -84.5708197139807+47.1770768187416i 96.83955867 > 156.9666667 -49.5335241663969-89.6174641256261i 102.3956049 > 157.2666667 -83.8826534062392+30.7721614046116i 89.34889736 > 156.3333333 22.4687435767936+90.7586387084729i 93.49852907 > 156.0333333 113.448294114525-65.8047049245391i 131.1517237 > 157.7666667 69.5965604037754-180.19293709252i 193.166187 > > The first column is the original signal in the time domain from 1-25. The > second column is the fft of the first. The third column is the abs value of > the fft values. I feel like I am close to understanding, but I am missing > something, so thank you very much for your help.
162509.466667 / 1024 = 158.700651 , which looks like it could be the average value of the first column. Have you tried subtracting that DC value from every sample in the first column? The values in the gaps will not be zero unless the data in your first column is composed of only of sinusoids which are exactly periodic in the fft aperture (1024 samples) (and there are less sinusoids than half the number of samples so as to leave some gaps). IMHO. YMMV. -- rhn A.T nicholson d.0.t C-o-M