I determined that the shift is somehow related to the bandwidth of my 
pulse.  If I make the source very narrowband (170 to 190 THz), the FFT 
from Matlab ends up in the correct position.

This may be related to a previous thread:

http://ab-initio.mit.edu/pipermail/meep-discuss/2006-October/000463.html

Best,
Matt




On Wed, 3 Sep 2008, Steven G. Johnson wrote:

> On Sep 3, 2008, at 1:19 PM, matt wrote:
>> I'm pretty certain that the matlab script is correct.  Is there
>> something in meep which could be causing the frequency shift?
>
> No, I can't think of anything in Meep that could cause a frequency
> shift of that sort, assuming all your units are consistent and correct.
>
> However, your Matlab script is slightly off.  The number of data
> points from the DC frequency to the Nyquist frequency, inclusive, is
> NFFT/2+1, not NFFT/2.   So, you should have:
>
>       f = (1/dt)/2*linspace(0,1,NFFT/2+1);
>       y=plot(f,2*abs(A(1:NFFT/2+1)));
>
> if I'm reading your code correctly.  (The DC frequency is "bin" 0 of
> the DFT, and Nyquist is the N/2-th bin, but because Matlab's indices
> are 1-based these become 1 and N/2+1, respectively.)
>
> Regards,
> Steven G. Johnson
>
>
> _______________________________________________
> meep-discuss mailing list
> meep-discuss@ab-initio.mit.edu
> http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss
>

_______________________________________________
meep-discuss mailing list
meep-discuss@ab-initio.mit.edu
http://ab-initio.mit.edu/cgi-bin/mailman/listinfo/meep-discuss

Reply via email to