Keyboard Shortcuts
Likes
Search
fft of sine wave
hi i wanted to use fft in ltspice for a sin wave(schamtic attached with name as : fft_sine_wave) . i saw that i have other frequency in fft result, why? second question: for a input signal with specific frequency, how value we select? total time and? time_step and number of sample? third question : if fft used the values from transient analysis, the time step in tran. analysis effect result of fft and how? thanks |
¿ªÔÆÌåÓýIf you do an FFT of just half a sine wave, that's what you get. If you change 5 ?s to 50?s and do the FFT you will see the strong line at 100 kHz and a lot of 'noise' at much lower levels. You should always simulate, if possible, for a whole number of cycles of every signal you are analysing. That may require many cycles, e.g. if you have 100 kHz and 105 kHz. Time step should be 1 % of the period? of the highest frequency, or less. The time-step affects the number of points in
a cycle that are evaluated. To minimize computation noise,
evaluate many points. Best wishes John Woodgate OOO-Own Opinions Only J M Woodgate and Associates Rayleigh, Essex UK On 2018-11-28 14:29, goy123t@...
[LTspice] wrote:
? |
goy123t, your waveform was not very sinusoidal, so it was no surprise that the FFT came out badly.? Always use a whole integer number of cycles. Imagine doing this:? Take your simulated waveform, and glue the end of the waveform and ithe beginning of the waveform to each other.? That's the thing that the FFT effectively operates on.? If you splice your original waveform like that, you wouldn't get a sine wave. Please see the FFT example in LTspice's Help: ? ? Help: Waveform Viewer > Waveform Arithmetic Notice the use of ".options plotwinsize=0" which you should ALWAYS have when preparing to do an FFT. Using .options numdgt=15 is "icing on the cake" and not normally needed. Total time (= Stop time - Time to start saving data) should always be a whole number of cycles of your signal.? I recommend starting with about 10 whole cycles.? 1 is bare minimum but not very satisfactory in the FFT display.? 100 cycles is OK but you be the judge on that.? If two or more signals are present, find a time interval that works for both frequencies, which is also related to the difference in frequencies. Time_step is best being "as small as possible."? Ideally, waveforms would be continuous, so the closer together the time points are, the better.? But very small time_step makes the simulation run slowly.? There's your main trade-off.? And always combine it with ".options plotwinsize=0" so that you aren't throwing away most of those time steps. Number of samples?? Which one do you mean? If it's "Number of data point samples in time", experiment with that.? More samples gives you an FFT that goes up higher in frequency, but it might be meaningless data at that end of the spectrum.? When the time interval between those "data point samples in time" becomes smaller than the simulated time_step, then the FFT is just interpolating between the available data, which is not real. If it's "Number of points" of Binomial Smoothing, I usually change that to 1.? This setting does a bit of smoothing before calculating the FFT.? If your waveforms are noisy, then bigger numbers may help; but it causes the high frequency end of the FFT to fall off more. ? ? "third question : if fft used the values from transient analysis, the time step in tran. analysis effect result of fft and how?" I think this was already answered.? The smaller the time_step, the more continuous the data is, that gets sent to the FFT.? There is no waveform data between time_steps, so the FFT has to guess what the waveform would have been, between those time_steps.? Smaller time_steps means the guesses are probably more accurate because they are closer to the actual simulated points in time. So, the time_step will mainly affect the harmonics at higher frequencyes; but not the fundamental. Regards, Andy |