Page 1 of 1

Macro Examples - PSD and data processing

Posted: Thu Dec 07, 2006 11:52 pm
by analysispros
Hi there,

Is anyone aware where can I find more DPlot Macro examples?
I am specifically looking for data processing Macros like generating PSD's from time history data and manipulating the time history.
Excel can't handle over 64000 rows and I can not do manipulations there.
There are couple of Macro examples that come with Dplot but it is not enough to teach someone the Macro language from scratch.

Thanks,

Roni Plachta

Posted: Fri Dec 08, 2006 2:28 pm
by DPlotAdmin
There is no macro repository on the site, but if you have specific questions about how to do something I'll be happy to answer them.

To generate the PSD:

FFTMethod(1)
FFT()
EditOperateY("Y^2")

FFTMethod(1) says "Don't pad the input record with 0's out to the next power of 2". As an aside, I may get rid of this option in a future release. For large records with large prime factors, the FFT calculation time can be long, but "long" is getting shorter all the time and there's no mathematical justification for padding with 0's.

Posted: Thu Jan 04, 2007 5:47 pm
by jsc
David,

DON'T get rid of pad w/zero's option - still very slow (microwave slow) on a large data set (400k points). Just tried it -seemed like 10 times slower, ie, 50 seconds vs. 5 seconds on my 1.73gHz laptop. Not everyone is using 3+ gHz machines to crunch data!

jsc

Posted: Thu Jan 04, 2007 6:00 pm
by DPlotAdmin
Noted :D

As long as you more or less understand what you're doing I suppose there's no harm in it. I should probably add a few examples showing how that option can give less-than-perfect results at some frequencies in certain cases.

Posted: Thu Jan 04, 2007 6:05 pm
by jsc
Well, I definitely fall into the category of not knowing what I am doing! (Well, sometimes!!)

So examples would be appreciated!

Posted: Thu Jan 04, 2007 6:24 pm
by DPlotAdmin
I'm no expert at FFTs either, but you can experiment with simple stuff like sine waves to see the difference. Just off the top of my head I tried this:

Y=sin(100*pi*X) with 0<X<4 and dX=0.0001

In a perfect world the FFT would show a single spike at 50Hz and 0's everywhere else. And that's very close to what you get if you check "Run the FFT as is". If you pad with 0's (which adds 25535 0's to your 40001 input points) you get the same spike at (close to) 50Hz and smaller nonsense values on either side of 50Hz. This admittedly isn't a bad problem in this case, but I'm reasonably sure I can come up with worse examples once I put my thinking cap on.