Fast Fourier Transform in SPICE
 User Name Stay logged in? Password
 Home Forums Rules Articles diyAudio Store Blogs Gallery Wiki Register Donations FAQ Calendar Search Today's Posts Mark Forums Read Search

 Solid State Talk all about solid state amplification.

 Please consider donating to help us continue to serve you. Ads on/off / Custom Title / More PMs / More album space / Advanced printing & mass image saving
 3rd February 2007, 04:03 PM #1 ptah   diyAudio Member   Join Date: Aug 2006 Fast Fourier Transform in SPICE I know most of you guys know SPICE inside and out. I am learning it with Linear Technologies version and have gotten all the basics down. What am I looking at when I run fast Fourier transform? It gives a plot of dB vs frequency for a specific voltage or current through a component. What does it mean?
 3rd February 2007, 06:45 PM #2 myhrrhleine   diyAudio Member     Join Date: Jan 2006 Location: Avalon Island Re: Fast Fourier Transform in SPICE You'll get the best answers from the email group LTspice@yahoogroups.com They discuss all aspects of LTSpice. __________________ [Grasshopper]:Old man, how is it that you hear these things? [master]:Young man, how is it that you do not?
 3rd February 2007, 08:08 PM #3 jcx   diyAudio Member   Join Date: Feb 2003 Location: .. the "trick" is that 0 dB = 1 Vrms or 1 Arms so a 1.414 V Sine gives a 0 dB output point on the fft plot and a 1 V sine would be -3 dB and since dB is suposed to be power ratio, other V or A rms amplitudes are displayed as 20*Log(x/1 Vrms), or 20*Log(x/1 Arms) another trick is that LtSpice is optimized for very long runs of their switching regulators, to keep file size down the default setting is to use compression on the data - which adds distortion in simulated waveforms for most audio circuits you will want to add a spice directive to the sheet: .option plotwinsize=0 to turn off the data file compression
 3rd February 2007, 08:44 PM #4 jcx   diyAudio Member   Join Date: Feb 2003 Location: .. I have posted a few sims and discussed other LtSpice issues in audio simulations here so searching for posts by user "jcx" containing words: "LtSpice" or "photobucket" (where I host my images, ~ 80% will be LtSpice circuit drawing/wave/fft plots) might help you see what can be done with LtSpice sims, often the .asc files are attached as well (my older posts might be better for learning LtSpice sim tricks)
 4th February 2007, 03:17 AM #5 thanh   diyAudio Member     Join Date: Jan 2004 Location: ho chi minh city I want to view FFT of V=Va-Vb. So how can I do ? Thanks! __________________ Justice for Victims of Agent Orange http://www.petitiononline.com/AOVN/Thank all of you!
 4th February 2007, 03:29 AM #6 teemuk   diyAudio Member   Join Date: Nov 2004 Location: Suomi, Finland Two methods (for LTspice): 1. Use arbitrary behavioral voltage sources and plot them. They support waveform arithmetics. 2. In FFT window right click the plot title. This should open an "expression editor" window. Write expression, press enter. Another useful command (besides turning compression off) is .fft The results of using this command can be seen by viewing the spice error log.
andy_c
Banned

Join Date: Apr 2003
Quote:
 Originally posted by thanh I want to view FFT of V=Va-Vb. So how can I do ? Thanks!
When you run your transient analysis, a dialog box will come up. Click once on any voltage listed (or better yet, one that's part of the expression you want to use). Then press Alt and double-click (per the text you see on the dialog). This will bring up the expression editor dialog. If you have previously used F4 to name some nodes, say, a and b, enter the expression V(a)-V(b). If you haven't named the nodes this way, you can escape out and name them now, or you can escape out and hover the mouse over the nodes you want to measure. The status bar will say something like "this is node N025". Then you could memorize those names and use them in the expression. Another way is to start out plotting any old voltage. Then once you get the plot, switch back to schematic view. Click on one of the nodes you want to measure to get a probe. Then drag the probe to the other node. This will plot the difference. To eliminate an unused plot, just right-click on the expression at the top of the plot and choose "delete this trace". This is all in the help files under Waveform viewer, trace selection. To plot the FFT of the waveform, just right-click on the plot and choose "FFT".

If all you care about is a sine wave and its harmonics, just put a ".FOUR" SPICE directive on the schematic directly using the "S" key. It might look something like this:

.four 20kHz 19 v(out)

The frequency in the .FOUR directive must match the frequency of the source. The expression above says to use 19 harmonics to calculate THD. To see the results, run transient and do a "View, SPICE error log". The signal, its harmonics and the THD will be shown in text form in this file. See the help files under "LTSpice, Dot commands" for details of .FOUR.

 7th February 2007, 10:26 AM #8 thanh   diyAudio Member     Join Date: Jan 2004 Location: ho chi minh city In "...raw" window, I click menu View/ FFT, a panel appears--> I have no allowance to edit expression I tried .FOUR 20khz 19 (v(a)-v(b)) but LTspice says "..error" __________________ Justice for Victims of Agent Orange http://www.petitiononline.com/AOVN/Thank all of you!
 7th February 2007, 11:01 AM #9 teemuk   diyAudio Member   Join Date: Nov 2004 Location: Suomi, Finland In FFT window right click the plot title. This should open an "expression editor" window. Write expression, press enter. The right syntax for the other command is .four frequency v(a)-v(b).
 7th February 2007, 11:30 AM #10 Dag   diyAudio Member     Join Date: Feb 2005 Location: Goteborg You guys probably know all about this but to get the most out of the FFT you shoul think about this: 1. You have to wait for a steadystate situation in the transient run before you do the fft. (That is, don't do the fft on the data from the start (0s), wait a few periods) 2. Use EXACT numbers of periods of the fundamental frequency for THD sims. Two is enough. 3. For intermodulation sims you have to use the lowest periodic frequency. f2=f1*1.1 => lowest periodic frequency =0.1*f1 (10 times longer sim time!!!!!!!) 4. Use fixed timesteps in the trans sims. Timestep= [2^-n / (lowest periodic frequency)] is a good choise. 5. To improve accuracy change "rel tol", "V tol" and "I tol" in the control panel. Smaller numbers = better accuracy. Too small nubers will only make the sims very slow or you might get DC convergence problems. (In LTS: Maybe you can switch off the compression here also as jcx suggested??? Or use .option plotwinsize=0 in the schematic) What is wrong or what did I miss??

 Posting Rules You may not post new threads You may not post replies You may not post attachments You may not edit your posts BB code is On Smilies are On [IMG] code is On HTML code is Off Forum Rules
 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Site     Site Announcements     Forum Problems Amplifiers     Solid State     Pass Labs     Tubes / Valves     Chip Amps     Class D     Power Supplies     Headphone Systems Source & Line     Analogue Source     Analog Line Level     Digital Source     Digital Line Level     PC Based Loudspeakers     Multi-Way     Full Range     Subwoofers     Planars & Exotics Live Sound     PA Systems     Instruments and Amps Design & Build     Parts     Equipment & Tools     Construction Tips     Software Tools General Interest     Car Audio     diyAudio.com Articles     Music     Everything Else Member Areas     Introductions     The Lounge     Clubs & Events     In Memoriam The Moving Image Commercial Sector     Swap Meet     Group Buys     The diyAudio Store     Vendor Forums         Vendor's Bazaar         Sonic Craft         Apex Jr         Audio Sector         Acoustic Fun         Chipamp         DIY HiFi Supply         Elekit         Elektor         Mains Cables R Us         Parts Connexion         Planet 10 hifi         Quanghao Audio Design         Siliconray Online Electronics Store         Tubelab     Manufacturers         AKSA         Audio Poutine         Musicaltech         Holton Precision Audio         CSS         Dx Classic Amplifiers         exaDevices         Feastrex         GedLee         Head 'n' HiFi - Walter         Heatsink USA         miniDSP         SITO Audio         Twin Audio         Twisted Pear         Wild Burro Audio

 Similar Threads Thread Thread Starter Forum Replies Last Post kelticwizard Everything Else 29 15th February 2007 01:38 AM bigpanda Solid State 7 22nd March 2005 09:00 PM ding Multi-Way 10 11th July 2004 09:55 PM Steve Eddy Everything Else 20 20th April 2004 03:12 PM Thicorrêa The Lounge 3 13th August 2003 01:51 AM

 New To Site? Need Help?

All times are GMT. The time now is 06:43 AM.