Spice simulation - Page 83 - 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 13th February 2009, 09:09 PM   #821
diyAudio Member
 
Join Date: Nov 2008
Location: Brazil
Thanks OS good work, do not understand why this amplitude ({sprt(2)})?

Window in which used fft ? I have an article in portuguese it has windows for measuring instruments in fft, I put only the table

Note:Leakage, behavior is not predictable where the signal is not zero(Ex: pink noise) this"leakage"just damaging the samples following.

Table:
Attached Images
File Type: gif table.gif (15.8 KB, 449 views)
  Reply With Quote
Old 14th February 2009, 12:05 AM   #822
diyAudio Member
 
ostripper's Avatar
 
Join Date: May 2008
Location: Albany , NY (smallbany)
Quote:
Thanks OS good work, do not understand why this amplitude ({sprt(2)})?
Not my work,man. Andy c. (the LT master) is the creator..

Perhaps he can explain sqrt (2) and the different
type windows you have presented. Curious ???
OS
  Reply With Quote
Old 14th February 2009, 12:27 AM   #823
andy_c is offline andy_c  United States
Banned
 
Join Date: Apr 2003
Oh, that sine_gen.zip is just something I threw together real quick to help OS troubleshoot a problem he was having with a high FFT residual a while back. It wasn't meant as some kind of model for how to do things in the most general way. I've attached a new one in which the frequency and number of FFT points are parameters, which makes it more general. The one OS posted works best only at 1 kHz.

The idea is to have the max time step be one period divided by (num_FFT_points - 1). I've also set it up to do an automatic THD calculation without having to do an FFT from the graphs. Run the sim and do a view, SPICE error log to see the zero percent distortion of the source in text form.

When doing an FFT from the graph, LTspice chooses 0 dB as 1 VRMS. Since 1 VRMS is sqrt(2) Volts peak, that's what I chose for the amplitude of the source. So when you do the FFT from the graph, the source will be normalized to 0 dB.

Edit: OS, I think you put the old sine_gen.zip on your site? I hadn't meant it for reference, just a quick fix. The one attached to this post is more general.
Attached Files
File Type: zip sine_gen.zip (468 Bytes, 135 views)
  Reply With Quote
Old 14th February 2009, 02:53 AM   #824
diyAudio Member
 
ostripper's Avatar
 
Join Date: May 2008
Location: Albany , NY (smallbany)
Quote:
I hadn't meant it for reference, just a quick fix.
thanks, andy, that is way cool..(attached) the old one still is WAY
better than a standard source , but this one takes the cake..
Os
Attached Images
File Type: gif toocool.gif (57.1 KB, 452 views)
  Reply With Quote
Old 14th February 2009, 03:47 AM   #825
diyAudio Member
 
ostripper's Avatar
 
Join Date: May 2008
Location: Albany , NY (smallbany)
I was just wondering, after simulating my new "baby".., could
one comment out a verbose distortion log ?? (H2 - H7)

looking at the data , it seems as the distortion readout sums
the fourier phases. could comments be added to give H2 , 3,5
and 7 , too ??

I can see my h2 and 3 here, (the 2 e-05's)


Fourier components of V(c)
DC component:0.041085

Harmonic Frequency Fourier Normalized Phase Normalized
Number [Hz] Component Component [degree] Phase [deg]
1 1.000e+03 8.060e+00 1.000e+00 -0.40 0.00
2 2.000e+03 1.979e-05 2.455e-06 -101.51 -101.11
3 3.000e+03 1.991e-05 2.470e-06 -103.13 -102.74
4 4.000e+03 6.748e-06 8.372e-07 157.60 157.99
5 5.000e+03 3.251e-06 4.033e-07 -122.74 -122.34
6 6.000e+03 5.045e-06 6.260e-07 165.93 166.33
7 7.000e+03 3.725e-06 4.621e-07 88.48 88.87
8 8.000e+03 3.740e-06 4.641e-07 169.05 169.45
9 9.000e+03 5.324e-06 6.606e-07 84.85 85.25
Total Harmonic Distortion: 0.000377%

OS
  Reply With Quote
Old 14th February 2009, 03:50 AM   #826
diyAudio Member
 
Join Date: Nov 2008
Location: Brazil
Thanks Andy

I wonder if it is possible obtain separate graphics of harmonics(2nd, 3rd, ...)Mag versus spectrum (20 and 20KHz)

This web , (4 fig) author used EWB:

http://www.geocities.com/ResearchTri...cheminf1e.html

I found these calculations that web, do not know if this related, with get graphics separated from the harmonics ?

http://www.allaboutcircuits.com/vol_2/chpt_7/2.html
  Reply With Quote
Old 15th February 2009, 04:59 PM   #827
andy_c is offline andy_c  United States
Banned
 
Join Date: Apr 2003
Quote:
Originally posted by ostripper
I was just wondering, after simulating my new "baby".., could one comment out a verbose distortion log ?? (H2 - H7)
Hmm, I'm not sure what you mean by that. Could you explain a bit more? The number of harmonics defaults to 9 if not specified. You can specify the number of harmonics you want displayed and included in the calculation. See the docs of ".FOUR" for how to do this.

Quote:
looking at the data , it seems as the distortion readout sums the fourier phases. could comments be added to give H2 , 3,5 and 7 , too ??
The Fourier phases don't play any part in the THD calculation. THD is calculated by taking the square root of the sum of the squares of the distortion component amplitudes, dividing that by the amplitude of the fundamental, and multiplying by 100 to get percent.

I might be misinterpreting your question though. I don't know of any way to change the distortion display in the error log other than specifying the number of harmonics that's included.
  Reply With Quote
Old 15th February 2009, 05:07 PM   #828
andy_c is offline andy_c  United States
Banned
 
Join Date: Apr 2003
Quote:
Originally posted by Rafael.luc
I wonder if it is possible obtain separate graphics of harmonics(2nd, 3rd, ...)Mag versus spectrum (20 and 20KHz)
I don't know of any automated way to do this in LTspice. If you want to simulate distortion over many frequencies, you can change this statement:

.param freq 1k

to:

.step param freq (options for .step command here)

See the documentation for .step for how to specify start value, stop value, increment, etc. You can do logarithmic steps, step in a list, etc. You'll want to change the stop time in the simulation to something like {20/freq} to give 20 cycles no matter what freq is.

Then the SPICE error log will have a table of harmonics for each frequency. I have plotted these in the past by pasting them into Excel. I don't know of any clean way to do this.
  Reply With Quote
Old 15th February 2009, 08:30 PM   #829
diyAudio Member
 
teodorom's Avatar
 
Join Date: Apr 2004
Location: Milano
There is an automated way to do all that.
Look in the LTSpice forum, libraries, all that, and you will find that way.
Using a little Perl program the simulation is run as many times you need then the results are collected so that they can be shown.
__________________
Teodoro
  Reply With Quote
Old 15th February 2009, 10:16 PM   #830
andy_c is offline andy_c  United States
Banned
 
Join Date: Apr 2003
I noticed that a while back, but it looks like it only plots THD vs. a parameter. If I understood correctly, Rafael was asking about individual harmonics (see his links).
  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
Need help with Spice simulation overmind Everything Else 4 23rd December 2002 04:58 PM


New To Site? Need Help?

All times are GMT. The time now is 03:10 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