<div dir="ltr"><div><div><div><div><div>To add a bit more to Maria's response .... <br><br>===<br></div>I used NCL's ezfftf and cfftf to look at the simple Example 1.<br></div>Normalized and unnormalized coefficients plus periodogram values are printed out. <br></div>Note that the 'cfftf' have twice the number of coef. They are normalized via (1/N) while ezfftf values use (N/2).<br></div>Note that the periodogram values for cfftf coefficients are symmetric.<br><br></div>Good luck<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Apr 15, 2015 at 10:20 AM, Maria Gehne - NOAA Affiliate <span dir="ltr"><<a href="mailto:maria.gehne@noaa.gov" target="_blank">maria.gehne@noaa.gov</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hi Thomas,<div><br></div><div>It is actually the imaginary part of the FFT in matlab that has opposite sign. If you compute example 1 on the NCL ezfftf page</div><div><a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/ezfftf.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/ezfftf.shtml</a><br></div><div>in Matlab you can see that. I attached a Matlab script that shows this. </div><div><br></div><div>Unlike NCL Matlab returns the same number of coefficients as input data N ( NCL only returns half N/2). The first coefficient in the Matlab FFT is the sum of all elements, divide by N and you get the mean. The next N/2-1 entries are the same as the N/2-1 last entries, except that they are complex conjugates. So depending on which direction you read from you will either get the same sign for the imaginary part as you get in NCL or the opposite.</div><div><br></div><div>Also the magnitudes returned by Matlab are not the same automatically. You need to divide the results by N/2 to match the NCL result.</div><div><br></div><div><br></div><div>Hope this helps,</div><div>Maria</div><div class="gmail_extra"><br><div class="gmail_quote"><div><div>On Tue, Apr 14, 2015 at 9:47 AM, Thomas Tobian <span dir="ltr"><<a href="mailto:thomastobian@gmail.com" target="_blank">thomastobian@gmail.com</a>></span> wrote:<br></div></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div><div dir="ltr">Dear NCL developers,<div><br></div><div>I recently worked a lot with Fourier analysis. Once, I compared the results of forward fft function in ncl and matlab. Please find attached, an example of FFT product for the meridional wind (V). So in general, the amplitudes and imaginary coefs produced by NCL and MATLAB are the same but the real part is of opposite sign. Any idea why? What is the process to use for the complex parts in NCL to convert back to longitude projection ? is there any big differences if the data has longitude -180 to 180 VS. 0-360?</div><div><br></div><div>Cheers,</div><div>Thomas</div><div><br></div></div>
<br></div></div>_______________________________________________<br>
ncl-talk mailing list<br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div><br></div></div></div>