# Non linear behaviour of a pure LC: Is it real or LT Spice is broken?

Questions:

1) Is the observed behaviour correct? (both cases at the resonant frequency and at a lower frequency) If it's not correct, why LT Spice is giving this result?

2) Why does circuit lab give a different result?

I've been playing with LT Spice and LC filters and made a couple of simulation in the frequency and time domain. So I've come across a strange phenomenon that I don't understand, and I'm also doubting that it is real, maybe it's a "defect" of the conditions set for the simulation.

Here is the simple circuit: simulate this circuit – Schematic created using CircuitLab

The transfer function is like this: $$H(S)=\frac{1}{(1+LCS^2)}$$ With the values set for L and C, the resonant frequency is roughly $$\ f_0 =50.33 kHz\$$.

Let the input signal frequency be $$\f_s\$$, so I expect that

• When $$\f_s << f_0\$$, Vout is almost identical to V1: no amplitude or phase difference between them. At this frequency the module of the transfer function is close to 0 dB.
• When $$\f_s = f_0\$$, Vout is amplified, the filter is resonating. We're at the peak of the bode diagram. In the time domain, I expect the have an oscillation with an increasing amplitude until it reaches a maximum amplitude. It then continues oscillating at that amplitude and at the resonant frequency.

In particular, the circuit is linear, so the output frequency shall be the same as the input frequency.

It doesn't really seem the case though: Above is the simulation result with $$\f_s = 1kHz\$$ (blue = Vout, red = V1, green = I(V1) ), and it is clear that 1 kHz is not the only harmonic of this signal. The FFT of LTSpice gives this result: There is a small, peak at the resonant frequency.

Where does this mathematically come from? The reverse laplace transform of the transfer function doesn't give any frequency different from the input signal frequency. So where does this come from? What calculations is LT Spice doing that gives this result?

Furthermore, there is another strange phenomenon with this circuit simulated with LT Spice. When $$\ f_s = 50.33 kHz\$$, a transient simulation gives a waveform that never gets to a "steady state", in contrast to what I expected. The image above is a 20ms time frame with $$\f_s = f_0\$$.

For completeness sake, here is the schematic used for the simulation: Final note: simulating the same circuit with circuit lab gives the result that I expected for both case ($$\fs = f0 \$$ and $$\fs << f0\$$ ). For some reason they're giving different results...

• Have you tried changing integration methods or the timestep for the simulation? Transient simulations, SPICE included, are well-known for having situations (such as resonant circuits) where the output quality is highly sensitive to simulation parameters. – nanofarad Jul 25 '20 at 17:46
• Also your LC tank is completely lossless, I mean: any energy in the tank has "nowhere to go". So if the tank is excited then it will resonate at 53 kHz whatever other frequency you apply. I suggest that you make the LC tank somewhat lossy by adding a series resistor. Start with 10 ohms and see what you get. Also realize that any simulator is a tool and it needs to be used correctly. You also need to learn how to use it. – Bimpelrekkie Jul 25 '20 at 17:49
• Run the 1kHz simulation for much longer (5-10x) and you'll start to see what's happening. – user_1818839 Jul 25 '20 at 17:54
• "There is a small peak"... Small peak??? That's the resonance peak. In a lossless circuit that peak goes up to infinity. IIRC LTSpice adds by default some parasitics in all its components so it does not have to deal with infinite quantities but that 'small peak' is what characterize your circuit. Andy has explained where the apparently alien frequency comes from (from your truncated input), so the circuit is behaving as expected. It just needs time to give you the stationary state you expect. – Sredni Vashtar Jul 25 '20 at 18:58
• I don't get it, you bothered to extract the transfer function, why not also do the inverse Laplace transform? You should be able to see why this happens. Just in case everything that's been said so far isn't clear, an analogic filter is also of an infinite impulse response type, since, in theory, the transients decay asymptotically; in practise there is always damping. As a final note, LTspice (and not only) is used world-wide by serious engineers; if something doesn't come out as expected, don't rush to blame the tool, rather, ask yourself what is it that you're not doing right. – a concerned citizen Jul 25 '20 at 19:11

## 1 Answer

Where does this mathematically come from?

Starting a sinewave from any point in its waveform is creating a transient. Prior to the sinewave being present there was 0 volts then suddenly you start-up a sinewave. This creates a transient response in the LC filter and, because it is highly resonant (limited only by any parasitic elements LTSpice defaults to), you get a resonant response that theoretically should take infinite time to decay. The high-frequency superimposed on the sinewave is the resonant frequency. Just look at the spectral result - it's at 50 kHz.

If you applied a step input in the s-domain you would get the same sort of transient behaviour.

• Flawless. So I suppose that when I feed the filter with the resonant frequency, I still see the superimposed response of the sine wave AND the "step response" given by the fact that the sine wave started from a zero constant value and wasn't a sine wave since t=-inf. Right? And that's why I don't see a steady state with a constant amplitude oscillation. – Elia Jul 26 '20 at 14:02
• Pretty much correct - the sine input and sine transient response are pretty close in terms of hertz so you get a beating effect or amplitude wobble as you can see in one of your pictures. – Andy aka Jul 26 '20 at 16:01
• Good thanks! Do you perhaps know why circuit lab doesn't take into account "both effects"? It does simulate the transient because I can see the amplitude increasing with time until it reaches the final amplitude. But there is no "superimposed" oscillation in circuit lab's result. – Elia Jul 26 '20 at 19:15
• I'm sorry. I never have used circuit lab and it's difficult to understand what output it produces without a picture. Maybe consider asking another question and putting both pictures side by side. – Andy aka Jul 26 '20 at 20:01