1
\$\begingroup\$

I've been trying to replicate the step response of an LC filter in LTSpice but so far I haven't been successful.

schematic

simulate this circuit – Schematic created using CircuitLab

That is the circuit I want to get the step response for. As expected, if I take the transfer function and run the step command in MATLAB, I get sustained oscillations.

$$H(s)=\frac{\frac{1}{Cs}}{\frac{1}{Cs}+ Ls} $$

enter image description here

Now, when I try to do it in LTSpice, I don't get that result:

enter image description here

enter image description here

I suspect the issue is that LTSpice doesn't really provide a step input as it doesn't go instantly from 0 to the final value when the source is turned on (which is what is done in MATLAB when using the step command).

\$\endgroup\$
  • \$\begingroup\$ Can you put a relay in? \$\endgroup\$ – John Birckhead Jun 2 '16 at 21:38
  • \$\begingroup\$ @JohnBirckhead I am not sure if I can do that, I don't know how to do that. I am starting my DC source from 0V at startup so that should replicate a step input. \$\endgroup\$ – Big6 Jun 2 '16 at 21:45
  • \$\begingroup\$ Note that the resonant frequency is 6.5 MHz. You would have to greatly expand the horizontal scale of your LTspice plot to see this. \$\endgroup\$ – Dave Tweed Jun 2 '16 at 21:52
  • \$\begingroup\$ I notice on your LTSPICE plot you have a very long simulation window. The period for the resonant frequency of your circuit is less than 1 us. Try changing the stop time and maximum timestep in LTSPICE. Set the maximum to be a few periods of oscillation, at minimum you need to sample at twice the Nyquest frequency which is 13.5 MHz or about 75 ns. \$\endgroup\$ – Captainj2001 Jun 2 '16 at 22:15
  • 1
    \$\begingroup\$ When using this circuit in LTspice, don't forget that LTspice, by default, adds a 1mOhm series resistance to the inductance and 1/Gmin shunt resistor to the capacitance, so they can damp the oscillations (I suspect Matlab uses them ideal). If you want the oscillations to go on forever, you need to override the values, explicitly set them to zero. \$\endgroup\$ – a concerned citizen Jul 19 '16 at 14:27
2
\$\begingroup\$

V1 is a currently a constant DC source of 1v. To replicate the first circuit, all you need to do is "remove" V1 after some energy has been put into the L and C components.

There are many ways in which this could be done, one such way is to right-click V1, advanced, set to PWL (piece-wise linear) and specify time and voltage levels, such as 0ms 1v, 0.999ms 1v, 1.0ms 0v (which produces a sharp turn-off edge) then observe the result in the chart. As Dave says, these values of L and C will produce a relatively fast oscillation - plan on zooming in quite a bit.

If you recall from inductor theory, a charged inductor suddenly presented to an open-circuit will try to produce an infinite voltage (in order to maintain the current flowing through it.) Thus, simply removing the voltage source altogether will not work. Instead, it has to go to 0v (in other words, be a solid conductor.) Then the circuit will oscillate.

Edit: to further illustrate this phenomenon, here is a screenshot of LTspice performing the complete impulse response. Click for full-size. Note some "loss" was added to the inductor (resistance) and capacitor, to better model real-world characteristics. This is why the amplitude decays slightly over time, and was shown because real-world electronics are far from ideal, with many kinds of losses.

LC Step Response.

\$\endgroup\$
  • \$\begingroup\$ I had assumed that the plot was taken from the voltage across the capacitor, not the the voltage source, but it isn't clear from the question what is actually being plotted. \$\endgroup\$ – Dave Tweed Jun 2 '16 at 22:04
  • \$\begingroup\$ It's the voltage across the capacitor @DaveTweed \$\endgroup\$ – Big6 Jun 2 '16 at 22:08
  • \$\begingroup\$ I've tried what you suggested @rdtsc but still can't get sustained oscillations. Anyway, when we talk about a step input (in control systems) we talk about a signal that goes from 0 to its final value instantenously and stays at its final value forever. That's what I am generating when I use the step command in matlab. \$\endgroup\$ – Big6 Jun 2 '16 at 22:29
  • \$\begingroup\$ Sorry, I hadn't seen your edited answer until now. Thanks. Anyway, you don't need to actually step the voltage down to zero (after you stepped it up to some value). The LC should oscillate about the final value of your step input. If you had kept the pulse on 'forever,' the oscillation would have happened about the final value of your step input (as it was showing until you turned off the pulse). And yes, you are correct, the series resistances (losses) associated with the components will dampen the oscillations to eventually steady state. Thanks for the response. It was really helpful! \$\endgroup\$ – Big6 Jun 30 '16 at 16:39
2
\$\begingroup\$

Others have provided good answers, but I thought some pretty pictures would be appropriate.

Here is your circuit in LTSpice. Note that behaviour of the voltage source: instead of being a constant source, it is a step that is initially at 0 V, rising to 1 V after 100 ns, with a rise time of 1 ps (close enough to instant).

enter image description here

The resulting plot clearly shows the step response and desired oscillation.

enter image description here

\$\endgroup\$
  • \$\begingroup\$ Thanks for the answer. I have tried that before and I get that. The smaller you make the rise time, the more oscillations you are going to have. Of course, we want to simulate as close as possible a step input(no rise time). But run your simulation up to, say, 8ms, and you will see that oscillations are going away and systems reaches steady state. This wouldn't be the case if the input was a pure step (rise time =0) \$\endgroup\$ – Big6 Jun 2 '16 at 23:22
  • 1
    \$\begingroup\$ Well, yes. LTSpice is a timestep-based simulation environment, and events cannot happen instantaneously. As it is typically used to simulate realistic circuits, this is not an issue. What are you ultimately trying to achieve? If you want entirely ideal simulations, MATLAB or similar is going to be more appropriate. \$\endgroup\$ – uint128_t Jun 2 '16 at 23:25
  • \$\begingroup\$ I just wanted to know if there was a way to accomplish this in LTSpice, but from what I see it's not possible to generate an ideal step input there. \$\endgroup\$ – Big6 Jun 2 '16 at 23:30
  • 1
    \$\begingroup\$ Yeah, sorry, LTSpice isn't really appropriate for instantaneous things. Mainly because infinitely short rise times lead to infinite derivatives, which make the simulator unhappy. Stick to your transfer function solver for ideal steps. \$\endgroup\$ – uint128_t Jun 2 '16 at 23:32
1
\$\begingroup\$

I don't know about LTspice specifically, but many circuit simulators initialize the simulation by finding the DC operating point of the circuit. If you want to see the start-up transient behavior, you need to disable this initialization.

For example, I have tweaked the schematic in your question so that the CircuitLab simulation runs, and you have to say "Yes" to the "Skip Initial" box in order to see the transient behavior.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.