Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

14
  • $\begingroup$ I get confused by your use of the semicolon. ;. Especially the double ;;. $\endgroup$ Commented Jun 6, 2023 at 18:21
  • 1
    $\begingroup$ @robertbristow-johnson That was in the original code. I didn't notice! Matlab just ignores it, in effect. $\endgroup$ Commented Jun 6, 2023 at 18:41
  • $\begingroup$ But if I make the change as you suggested, then amplitudes won't align. Is this just a matter of shifting the x axis around? It causes no end in confusion the way that MATLAB requires the fftshift(fft(x))... $\endgroup$ Commented Jun 6, 2023 at 20:39
  • 3
    $\begingroup$ @Darcy Go back to basics: go to the matlab site I linked to and see how they've defined it. Matlab doesn't require anything of the sort (fftshift). You may want to use if for display of centered data. I rarely do. I just plot the positive frequencies if it's an issue. $\endgroup$ Commented Jun 6, 2023 at 20:54
  • 1
    $\begingroup$ You seem to have forgotten to mention fftshift(fft(x)) -> fft(x). Your edit makes it a standard FFT. $\endgroup$ Commented Jun 7, 2023 at 4:38