The Designer's Guide Community
Forum
Welcome, Guest. Please Login or Register. Please follow the Forum guidelines.
Oct 17th, 2019, 4:29pm
Pages: 1
Send Topic Print
some MATLAB DFT questions (Read 7990 times)
SoliS
Junior Member
**
Offline



Posts: 14

some MATLAB DFT questions
Nov 21st, 2011, 8:41am
 
Attached is a plot of a DFT I generated in MATLAB. The input is just a sine wave at 10kHz, generated with MATLABs sine function.

I am wondering why there is a 20 dB/decade roll off characteristic after the 10 kHz peak; I would expect just a flat noise floor. I am not too familiar with the intricacies of the FFT/DFT.

I ask this because I am trying to apply 2 low pass filters (RC networks) to the sine wave by using the discretized version (difference equation). When I apply the filters, I do not see the characteristic 20db/dec roll off that I expect; the second filter should give 40 dB/dec, but they all have the same slope and I think something in the DFT is obscuring it.

Back to top
 

DFT.png
View Profile   IP Logged
SoliS
Junior Member
**
Offline



Posts: 14

Re: some MATLAB DFT questions
Reply #1 - Nov 21st, 2011, 8:45am
 
here is a plot of some data after it's been "filtered"

green is before the low pass filter, implemented with the equation

y(n) = input(n)*(deltaT / (RC+deltaT)) + y(n-1) * (RC / (RC+deltaT))

where RC is the resistor/capacitor time constant, and deltaT is the spacing in my time vector.

As you can see, as the first LPF is applied (blue line), the "slope" does not increase at all, but the high frequency peaks are attenuated. Why is the "noise floor" not attenuated?

red line is a second filter applied; peaks are again attenuated but no visible difference in "noise floor"
Back to top
 

filtered.png
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: some MATLAB DFT questions
Reply #2 - Nov 22nd, 2011, 2:30am
 
SoliS wrote on Nov 21st, 2011, 8:41am:
I am wondering why there is a 20 dB/decade roll off characteristic after the 10 kHz peak; I would expect just a flat noise floor.
It is because your input signal does not have an integer number of periods. The DFT is the Fourier transform of the infinitely extended periodic signal.
- B O E
Back to top
 
 
View Profile   IP Logged
SoliS
Junior Member
**
Offline



Posts: 14

Re: some MATLAB DFT questions
Reply #3 - Nov 22nd, 2011, 7:16am
 
boe wrote on Nov 22nd, 2011, 2:30am:
SoliS wrote on Nov 21st, 2011, 8:41am:
I am wondering why there is a 20 dB/decade roll off characteristic after the 10 kHz peak; I would expect just a flat noise floor.
It is because your input signal does not have an integer number of periods. The DFT is the Fourier transform of the infinitely extended periodic signal.
- B O E



thanks for this, I applied a windowing function and am getting results much closer to what I was expecting. Now I am just figuring out which window is optimal for the data I want to display.

I originally thought I had an integer # of periods because of the way I defined my time vector (WRT the frequency of the sine wave) but after passing it through my system there is a delay introduced and a startup edge, causing it to differ from an integer # of periods ever so slightly (not visible on the plots).
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: some MATLAB DFT questions
Reply #4 - Nov 22nd, 2011, 8:10am
 
SoliS wrote on Nov 22nd, 2011, 7:16am:
I originally thought I had an integer # of periods because of the way I defined my time vector (WRT the frequency of the sine wave) but after passing it through my system there is a delay introduced and a startup edge, causing it to differ from an integer # of periods ever so slightly (not visible on the plots).
In this case you should consider running a longer vector through your system and cutting away the initial settling period prior to windowing.
- B O E
Back to top
 
 
View Profile   IP Logged
SoliS
Junior Member
**
Offline



Posts: 14

Re: some MATLAB DFT questions
Reply #5 - Nov 22nd, 2011, 8:20am
 
boe wrote on Nov 22nd, 2011, 8:10am:
SoliS wrote on Nov 22nd, 2011, 7:16am:
I originally thought I had an integer # of periods because of the way I defined my time vector (WRT the frequency of the sine wave) but after passing it through my system there is a delay introduced and a startup edge, causing it to differ from an integer # of periods ever so slightly (not visible on the plots).
In this case you should consider running a longer vector through your system and cutting away the initial settling period prior to windowing.
- B O E


Maybe I am missing something, but...

what about just increasing the length of the time vector and not cutting out the settling time? this would reduce its effects on the DFT. though I realize it is more unrealistic to leave it in there, as the DFT will show me what happens when I have a startup settling time every X periods of my waveform. I assumed this part of the waveform would be de-emphasized by the window in the first place. (it's only ~20 points of settling time out of a 100k point vector).


Also, any recommendations for what type of window to use? I am trying to show the effects of low pass filtering on the image peaks of a sampled-and-held and reconstructed waveform.
Back to top
 
 
View Profile   IP Logged
boe
Community Fellow
*****
Offline



Posts: 615

Re: some MATLAB DFT questions
Reply #6 - Nov 23rd, 2011, 9:57am
 
SoliS wrote on Nov 22nd, 2011, 8:20am:
...
what about just increasing the length of the time vector and not cutting out the settling time? this would reduce its effects on the DFT.
But slowly. Dropping them is usually much more effective.
NB: 20dB/decade roll-off is caused by a discontinuity in the periodically extended signal.
Quote:
though I realize it is more unrealistic to leave it in there, as the DFT will show me what happens when I have a startup settling time every X periods of my waveform. I assumed this part of the waveform would be de-emphasized by the window in the first place. (it's only ~20 points of settling time out of a 100k point vector).
Yes. But if you remove those ~20 points before windowing, there is much less to do for the windowing function. You may not even need any windowing if you use enough points for settling.

Quote:
Also, any recommendations for what type of window to use?
Note: A window in the time domain is essentially a "low-pass filter in the frequency domain".
Quote:
... I am trying to show the effects of low pass filtering on the image peaks of a sampled-and-held and reconstructed waveform.


- B O E
Back to top
 
 
View Profile   IP Logged
Pages: 1
Send Topic Print
Copyright 2002-2019 Designer’s Guide Consulting, Inc. Designer’s Guide® is a registered trademark of Designer’s Guide Consulting, Inc. All rights reserved. Send comments or questions to editor@designers-guide.org. Consider submitting a paper or model.