NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.
To learn about what's going on, see About the Archive Site.
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"> <title></title> </head> <body text="#000000" bgcolor="#ffffff"> Actually, I'm a newbie to both visad *and* Fast Fourier Transforms, so sorry if I'm a little ignorant of the two. my first question is, can the FFT object be used outside of the spreadsheet application? I thought it could, but am less sure after reading the docs.<br> <br> if so, I am trying to get a FFT of a sequence of 0's and 1's where each digit corresponds to the h(t) value where t = time. Once calculated, I'm simply trying to find the freuquency with the greatest intensity, so there's no need for me to show it graphically.<br> <br> however, it looks like the fft methods I want to use, i.e. FFT1D, require a matrix submission. am i correct in this? and if so, how does one convert a 1-dimensional sequence into the matrix. I haven't seen any documentation describing how\whether this is necessary<br> <br> I've also looked at the forwardFT, backwardFT, and fourierTransform functions, but am still trying to decipher VisAD's data model and figure out what a Field and a FlatField are. I'll gladly continue to try to figure these out, but can someone point me in the right direction, i.e. should I be trying to use the fourierTransform method or the FFT1D method?<br> <br> currently, this is my code:<br> <br> <blockquote><tt> // generate sequence to transform sConv....<br> <br> double[][] time;</tt><br> <tt> // find the 1st power of two larger than the length of sConv</tt><br> <tt> int size = 1;</tt><br> <tt> while (size < sConv.length()) {</tt><br> <tt> size *= 2;</tt><br> <tt> }</tt><br> <tt> </tt><br> <tt> time = new double[1][size];</tt><br> <tt> System.out.println ("length: " + sConv.length());</tt><br> <tt> System.out.println ("power of 2 : " + size);</tt><br> <tt> </tt><br> <tt> // double[][] time = new double[1][sConv.length()];</tt><br> <tt> for (int i = 0; i < sConv.length(); i ++) {</tt><br> <tt> time[0][i] = sConv.charAt(i);</tt><br> <tt> }</tt><br> <tt> </tt><br> <tt> System.out.println ("application " + sConv);</tt><br> <tt> System.out.println ("calling FFT");</tt><br> <tt> </tt><br> <tt> FFT fft = new FFT();</tt><br> <tt> double[][] trans = new double [1][1];</tt><br> <tt> try {</tt><br> <tt> trans = fft.FFT1D (time, true);</tt><br> <tt> int i = 0;</tt><br> <tt> if (trans.length > 0) {</tt><br> <tt> for (int j = 0; j < trans[i].length; j++) {</tt><br> <tt> String temp = new String(j + "\t");</tt><br> <tt> for (i=0; i< trans.length; i++) {</tt><br> <tt> temp = temp + trans[i][j] + "\t";</tt><br> <tt> }</tt><br> <tt> System.out.println (temp);</tt><br> <tt> }</tt><br> <tt> }</tt><br> <tt> }</tt><br> <tt> catch (Exception e) {</tt><br> <tt> System.err.println (e.getMessage());</tt><br> <tt> }</tt><br> </blockquote> <br> when this code is executed, a VisADException is thrown with the err message, bad x lengths...<br> <br> thanks for any help or insights,<br> <br> Peter Waltman<br> <br> <br> </body> </html>
visad
archives: