Keyboard Shortcuts
Likes
- LTspice
- Messages
Search
Re: Determine phase and gain margin in filter/amp
---In LTspice@..., <405a82e5@...> wrote: Frank, that is absolutely spectacular! Thanks very much. Also thanks for the explanation of the second condition in the Omicron paper. It means we have no problems to use the Voltage Injection method for most practical circuits in LTspice. This is very good news. Thanks very much for the .measure commands. I would probably have had great trouble converting the Tian commands since they are so long. It is much easier to understand how the commands work when they are much shorter: .meas ac phase_margin find V(fb)/V(inm) when mag(V(fb)/V(inm))=1 .meas ac gain_margin find V(inm)/V(fb) when ph(V(inm)/V(fb))=0 In the second command for gain margin, why did you invert the ratio to V(inm)/V(fb)? Was that to give a positive result to the answer? Why is that needed? Yes, like I wrote in Measure_Margins.asc, I wanted to have positive values for stable circuits. Best regards, Frank |
Re: Determine phase and gain margin in filter/amp
monettsys
--- In LTspice@..., <sawreyrw@...> wrote:
Hi Rick, Thanks for the explanation. My version only works with left click. You really should take a look at Frank's solution. I extended the frequency range to .ac dec 1000 1m 10Meg Two runs gave the following results: phase_margin: v(fb)/v(inm)=(-8.38981e-007dB,55.9047) at 1.21103e+006 gain_margin: v(inm)/v(fb)=(15.3886dB,6.6374e-005) at 3.7333e+006 Date: Wed Dec 11 01:01:52 2013 Total elapsed time: 0.140 seconds. phase_margin: v(fb)/v(inm)=(-8.38981e-007dB,55.9047) at 1.21103e+006 gain_margin: v(inm)/v(fb)=(15.3886dB,6.6374e-005) at 3.7333e+006 Date: Wed Dec 11 01:02:33 2013 Total elapsed time: 0.130 seconds. As you can see, they are very repeatable. In fact, the second run was made with no graph, so you don't even need to plot the waveforms to get the answer! This fulfills my wish to have a method that gives the same result for everyone. My very sincere thanks to Frank for his work. Thanks for posting your original results. It led directly to this very excellent solution. Mike |
Re: Determine phase and gain margin in filter/amp
monettsys
--- In LTspice@..., <frank_wiedmann@...> wrote:
Frank, that is absolutely spectacular! Thanks very much. Also thanks for the explanation of the second condition in the Omicron paper. It means we have no problems to use the Voltage Injection method for most practical circuits in LTspice. This is very good news. Thanks very much for the .measure commands. I would probably have had great trouble converting the Tian commands since they are so long. It is much easier to understand how the commands work when they are much shorter: .meas ac phase_margin find V(fb)/V(inm) when mag(V(fb)/V(inm))=1 .meas ac gain_margin find V(inm)/V(fb) when ph(V(inm)/V(fb))=0 In the second command for gain margin, why did you invert the ratio to V(inm)/V(fb)? Was that to give a positive result to the answer? Why is that needed? For others who may be interested, I should mention you have an excellent set of articles on your home page at There is also a very good thread discussing open loop gain starting with your post in 2004: Thanks again, Mike |
Re: FFT Resolution
¿ªÔÆÌåÓýHi Steve and AndyYoull only be able to see the side bands if the sample is long enough to encompass an integral number of modulation periods. (and an integral number of carrier periods. The two should be integrally related to minimize artifacts.) The more info that gets sampled, the better the resolution. Hence is why the default FFT size is 262k, but of course you can set that to any thing needed. Al D. On 12/10/2013 06:11 PM, Andy wrote:
-- AC2CL I do not think there is any thrill that can go through the human heart like that felt by the inventor as he sees some creation of the brain unfolding to success... Such emotions make a man forget food, sleep, friends, love, everything. - Nikola Tesla |
Re: Questions about phase in .AC LTspice Analysis
Hnguyen wrote: "Q1: Why |Vop| and |Vom| are nearly equal??why not equal?"
A1: ?Ideally they are equal. ?Real circuits are not ideal. ?If there is any common-mode component present in the output signal, the two output pins would not be precisely complementary and then their amplitudes might not be equal.
"
A2: ?When exactly complementary, if you look at their AC components (and ignore the DC offset), V(vom) = -V(vop).
V(vop,vom) = V(vop)-V(vom) = V(vop)-(-V(vop)) = 2*V(vop).
So, in an AC simulation, the amplitudes of vop and vom should be equal, and the amplitude of V(vop,vom) should be 6 dB higher.
Andy |
Re: FFT Resolution
The widths of the peaks depend highly on the number of samples per cycle. It also depends a lot on the windowing function that is used.My hunch is that, for an FFT, it is often an indicator of non-infinite sampling duration. If you sample with the same number of samples per cycle, the peaks are narrower as you include more cycles. To me, that says that much of the observed peak width is not "real".?
toggle quoted message
Show quoted text
Jim Wagner Oregon Research Electronics On Dec 10, 2013, at 3:11 PM, Andy wrote:
|
Re: Determine phase and gain margin in filter/amp
---In ltspice@..., <405a82e5@...> wrote: Thanks, Frank. ? ? I have uploaded to the Temp folder an example circuit from ?where I have included the .meas commands for the phase and gain margins. For further explanations, please see Measure_Margins.asc. I have also?reduced the step size of the .ac simulation in order to get more precise results. ? The second condition in the Omicron article means that the voltage loop gain is only a good approximation for the loop gain as long as the loop gain is much larger than the ratio |Zout/Zin|. Because the first condition means that this ratio has to be much smaller than 1, this second condition is automatically satisfied at |T|=1 (or 0 dB), where you measure the phase margin. ? Best regards, ? Frank??????????????????????????? |
Re: FFT Resolution
Steve K. wrote: "
...? what's the narrowest possible harmonic bandwidth that ought to be expected? In other words, when is the simulation as optimized as it can be?"Good question. ?I don't know. Steve continued, "On a more general note, assuming artifacts of a non-ideal simulation have been minimized, does the harmonic bandwidth provide useful information, or do only the peak values matter?"
I think the widths could matter, depending. ?If anything non-ideal is going on that modulates the signal in some way, whether by varying its amplitude or its phase or frequency, that should translate into sidebands around each of the frequency components of the square wave signal. ?So if you are looking for that sort of thing, and assuming that the FFT is good enough to resolve those sidebands (and not just an artifact of doing the FFT), then it could be useful information. ?But to someone else, it might not matter.
When some sort of modulation is going on, energy gets transferred from the signal at the peak, into the sidebands around it. ?So as the amount of modulation gets worse, I think I would expect to see the peak shown by the FFT to decrease, while the width increases.
Andy |
Re: Questions about phase in .AC LTspice Analysis
hoa van nguyen
Hello Andy Andy: If
they were complementary, then |Vop| and |Vom| would be nearly equal,
their phases would be opposite (180 degrees apart), and V(vop,vom) would
be larger than either one, rather than smaller. ?None of these things
are happening in your .AC simulation.
Q1: Why |Vop| and |Vom| are nearly equal? why not equal? Q2: How do you know that V(vop,vom) would be larger than either one. Could you share your thoughts with me? Regards Hnguyen On Saturday, December 7, 2013 4:01 PM, Jerry Lee Marcel wrote:
?
Le 06/12/2013 16:28, Andy a ¨¦crit?:
?Thanks for this explanation. I just wonder why the OP included this statement. |
Re: FFT Resolution
John Woodgate
In message <l87u7c+ebvu@...>, dated Tue, 10 Dec 2013, "skleiser@..." <skleiser@...> writes:
Given (in this case) a square wave of fixed frequency, fast but non-zero rising & falling edges, 50% duty cycle, and an exact integer number of cycles (etc.), what's the narrowest possible harmonic bandwidth that ought to be expected? In other words, when is the simulation as optimized as it can be?harmonic bandwidth doesn't depend on those things. Embedded in the Help on the B source is: "In LTspice, the impulse response is found from the FFT of a discrete set points in frequency domain response. This process is prone to the usual artifacts of FFT's such as spectral leakage and picket fencing that is common to discrete FFT's. LTspice uses a proprietary algorithm that exploits that it has an exact analytical expression for the frequency domain response and chooses points and windows to cause such artifacts to diffract precisely to zero. However, LTspice must guess an appropriate frequency range and resolution. It is recommended that the LTspice first be allowed to make a guess at this. The length of the window and number of FFT data points used will be reported in the .log file. You can then adjust the algorithm's choices by explicitly setting nfft and window length. The reciprocal of the value of the window is the frequency resolution. The value of nfft times this resolution is the highest frequency considered." The significant words are: "The reciprocal of the value of the window is the frequency resolution." Frequency resolution is the same as the observed 'harmonic bandwidth'. The harmonic energy is averaged over the bandwidth, so widening the bandwidth tends to reduce the observed amplitude. -- OOO - Own Opinions Only. With best wishes. See www.jmwa.demon.co.uk Nondum ex silvis sumus John Woodgate, J M Woodgate and Associates, Rayleigh, Essex UK |
Re: FFT Resolution
Given (in this case) a square wave of fixed frequency, fast but non-zero rising & falling edges, 50% duty cycle, and an exact integer number of cycles (etc.), what's the narrowest possible harmonic bandwidth that ought to be expected? In other words, when is the simulation as optimized as it can be?
toggle quoted message
Show quoted text
On a more general note, assuming artifacts of a non-ideal simulation have been minimized, does the harmonic bandwidth provide useful information, or do only the peak values matter? Just curious, Steve K. --- In LTspice@..., Andy <Andrew.Ingraham@...> wrote:
|
Re: Determine phase and gain margin in filter/amp
monettsys
--- In LTspice@..., <frank_wiedmann@...> wrote:
That's actually what I was trying to suggest. With the help of my comment in Measure_Margins.ascThanks, Frank. The omicron article gives good information, including derivations. Thanks for posting the link. The first condition is pretty easy - inject the signal at the input to the op amp as shown in Lokere's demo. I don't understand the second condition. I think it applies when you are injecting a signal across a small resistor via a transformer, where the impedances are part of the result. I don't think it was ever mentioned for applications in SPICE. Would you care to help translate your .measure commands to the Voltage Injection method? You are familiar with the method and could avoid a lot of errors that others may encounter. Thanks, Mike |
Re: Determine phase and gain margin in filter/amp
Mike, ? If you only want to put one cursor on the trace up can click right or left click on the label.? It works fine for me, if I set the cursor near the 0 dB point before?I expand the trace.? It takes only a few seconds to do it.? For example it is easy to get -934.5 udB and 107.19 degrees at 9.166 MHz ? Rick? |
Re: Determine phase and gain margin in filter/amp
monettsys
--- In LTspice@..., <sawreyrw@...> wrote:
Thanks, Rick. Do you mean Left Click? I tried it and still got inconsistent results, especially when you zoom in on the waveform. It takes quite a bit of fiddling to get the cursor as close to 0 dB as possible, and the results depend on the zoom level. I'm looking for a method that will give everyone the same results every time. The .measure command looks most promising. It will also be faster, and I can copy the data directly from the error log and paste it in a report. Thanks, Mike |
Re: Keep getting Unknown Subcircuit err LM13700
Hello,
You will find examples in our Files section. http://groups.yahoo.com/neo/groups/LTspice/files/%20Lib/OTA%20CA3080%20and%20LM13700/ Just copy LM13700.asy and LM13700.mod in the folder of your schematics. Additionally include the model file in your schematic. .include LM13700.mod or .lib LM13700.mod Best regards, Helmut |
Re: Keep getting Unknown Subcircuit err LM13700
Ok, replaced the .MOD file to my own working dir. And included the following: .INCLUDE C:\Users\...\LTSPICE lib\LM13700.MOD Now LTSpice is telling me there's a port mismatch between "lm13700" and "xu1". The asy has 9 ports (1 to 8 + 11), the .MOD file also describes 9 ports: .SUBCKT LM13700 1 2 3 4 5 6 7 8 11 Am I missing something? |
Re: Keep getting Unknown Subcircuit err LM13700
John Woodgate
In message <6939C6D9E5727A428B0A00DBB4359A3226AB9E8E@...>,
dated Tue, 10 Dec 2013, Ray Merewether <ray.merewether@...> writes: Don¡¯t use notepad.? It screws up the LTspice preferred end of lineIndeed, but that might not produce a 'Cannot find...' error. Equally, the chunk of HTML in the netlist at V7 won't be any help at all and must be deleted, but that also might not cause a 'Cannot find...' error. -- OOO - Own Opinions Only. With best wishes. See www.jmwa.demon.co.uk Nondum ex silvis sumus John Woodgate, J M Woodgate and Associates, Rayleigh, Essex UK |