THD from Spice simluation - diyAudio
Go Back   Home > Forums > Design & Build > Software Tools

Software Tools SPICE, PCB CAD, speaker design and measurement software, calculators

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
Reply
 
Thread Tools Search this Thread
Old 4th June 2004, 12:44 PM   #1
Prune is offline Prune  Canada
Account Disabled
 
Join Date: Mar 2003
Location: Vancouver
Question THD from Spice simluation

LTSpice has no THD analyzer. How can I estimate the THD using the FT plot below?

Click the image to open in full size.
  Reply With Quote
Old 4th June 2004, 12:49 PM   #2
Electrons are yellow and more is better!
diyAudio Member
 
peranders's Avatar
 
Join Date: Apr 2002
Location: Göteborg, Sweden
Blog Entries: 4
You can do it manualy.

SQR((2nd)^2 + (3rd)^2 + (4th)^2 + etc), geometric addition


Take the result and compare it with 1 kHz, the fundamental

2nd = first harmonics, 2 kHz
3rd = second harmonics, 3 kHz
__________________
/Per-Anders (my first name) or P-A as my friends call me
Super Regulator SSR03 Group buy. Still time for signing up.
  Reply With Quote
Old 4th June 2004, 01:31 PM   #3
moamps is offline moamps  Croatia
diyAudio Member
 
Join Date: Oct 2002
Location: Croatia
Quote:
Originally posted by peranders
2nd = first harmonics, 2 kHz
3rd = second harmonics, 3 kHz [/B]
Hi,
".......The fundamental frequency is alternatively called the first harmonic......"
2nd=second, etc.
Regards
  Reply With Quote
Old 4th June 2004, 02:20 PM   #4
Pedja is offline Pedja  Serbia
diyAudio Member
 
Join Date: Jun 2002
Location: Belgrade
Prune,

Enter dot four command using “SPICE directive” button (keyboard shortcut is 'S').

Should look like:
.four 1kHz V(out)
(for the harmonics of 1kHz at the point marked as out).
Then you can see the THD and the levels of individual harmonics if you run the transient analysis and check log file under View > Spice Error Log.

LT SwCAD by default computes for the first 9 harmonics. You can define the number of harmonics you are interested for as well. Then the line should look like:
.four 1kHz 4 V(out)
(assuming you are interested for the first 4 harmonics only)

Pedja
  Reply With Quote
Old 4th June 2004, 05:09 PM   #5
sam9 is offline sam9  United States
diyAudio Member
 
sam9's Avatar
 
Join Date: Jun 2002
Location: Left Coast
You also need to click on "Tools", then on "Control Pannel", then on "Compression". Then uncheck the boxes, the calculation doesn't give reasonable values when applied to compressed data.

Next run the tansient analysis, then click on "View" while the schematic window is selected, then click on "Spice Error Log" and scroll down until you find what you are looking for.

Note that the frequency specified in the ".four" directive must be the same as specified in your signal source when you run the transiient. If you forget and change only one you will get spurious (usually dramaticly so) results.

I've read on the LT spice forum that you get more accurate results if you select "time stop" and "maximum time step" such that the transient spans a whole number of cycles, i.e., no fractional cycles.

I've found 5 cycles are enough to get what I want to know but a few more might help.

Some transient waveforms take a while to reach a steady state, such as when a cap has to charge before the pattern settles down. In this case you will need to specify a start time after the steady state is obtained.

Finally, be aware that the THD figures you will get from circuit you actually construct will not be as good as what you see in LT Spice. Thus "fine tunning" your circuit to get the last .0005% THD out may be educational and entertaining but unlikely to be of any significance when you actually construct the circuit.
  Reply With Quote
Old 4th June 2004, 06:26 PM   #6
diyAudio Member
 
Join Date: Nov 2003
Location: NW Washington
Send a message via MSN to officeboy
So I’m a bit worried here, since I got

Total Harmonic Distortion: -1.#IND00%
with the universal opamp, and then

Total Harmonic Distortion: 579.678388%
with one of the LT opamps.
is there a way to import someone else's opamps since I’m not familiar with LT's products.
  Reply With Quote
Old 4th June 2004, 08:39 PM   #7
Electrons are yellow and more is better!
diyAudio Member
 
peranders's Avatar
 
Join Date: Apr 2002
Location: Göteborg, Sweden
Blog Entries: 4
Quote:
Originally posted by moamps

Hi,
".......The fundamental frequency is alternatively called the first harmonic......"
2nd=second, etc.
Regards
Thanks for the correction. This was a case of swedish in english..
__________________
/Per-Anders (my first name) or P-A as my friends call me
Super Regulator SSR03 Group buy. Still time for signing up.
  Reply With Quote
Old 4th June 2004, 11:47 PM   #8
sam9 is offline sam9  United States
diyAudio Member
 
sam9's Avatar
 
Join Date: Jun 2002
Location: Left Coast
"So I’m a bit worried here, since I got

Total Harmonic Distortion: -1.#IND00%
with the universal opamp, and then

Total Harmonic Distortion: 579.678388%
with one of the LT opamps.
is there a way to import someone else's opamps since I’m not familiar with LT's products."

I think you need to add code to the universal op amp.

Regarding the other - that sound like what you get when the freq specified in the .four statement is different from the freq specified in the transient analysis.
  Reply With Quote
Old 5th March 2009, 05:54 PM   #9
sam244 is offline sam244  India
diyAudio Member
 
Join Date: Mar 2009
Default Current harmonics

Hi all,

I am trying to calculate the THD of the output current in Ltspice......(Id(M12)-Id(M13)).....but everytime getting a message that....the current is not present in data....I am attaching the netlist....PLz help..
Attached Files
File Type: txt netlist.txt (5.6 KB, 24 views)
  Reply With Quote
Old 6th March 2009, 07:31 AM   #10
Elvee is offline Elvee  Belgium
diyAudio Member
 
Elvee's Avatar
 
Join Date: Sep 2006
Why do you want to do it manually? It is much simpler to use the command: .four 1K I(out)
(view results in Spice Error Log)
  Reply With Quote

Reply


Hide this!Advertise here!
Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Help with LT Spice Bonsai Solid State 9 5th September 2008 12:32 AM
New to SPICE WithTarragon Pass Labs 2 6th June 2008 06:32 PM
Free Spice Or Cheap Spice Simulator-Where To Start? kelticwizard Everything Else 29 15th February 2007 01:38 AM
1- 800- Go- Spice EternaLightWith Parts 9 21st May 2003 03:51 AM
P-spice THD JensRasmussen Solid State 10 18th October 2002 05:18 AM


New To Site? Need Help?

All times are GMT. The time now is 01:51 PM.


vBulletin Optimisation provided by vB Optimise (Pro) - vBulletin Mods & Addons Copyright © 2014 DragonByte Technologies Ltd.
Copyright ©1999-2014 diyAudio

Content Relevant URLs by vBSEO 3.3.2