# Plot voltage for different resistor values in LTSpice

I've signed up for a SPICE course at work, that will take place on Monday and I'm desperately trying to learn electronics and SPICE. (I work as an embedded engineer but with very lacking electronics skills)

I saw this circuit in chapter 2.13 of Practical Electronics for Inventors and thought I'd try to reproduce something similar using LTSpice.

To start with, I tried to create a circuit where the resistance increases linearly over time, and use that to plot a graph of voltage and current over time. So I guess, I'm expecting LTSpice to treat the circuit as having an ideal voltage source.

I had expected the current to be straight decreasing line since (i) the dependency between voltage and current is linear and since (ii) the resistance increases linearly. But current is displayed as a curve. (The voltage appears to be a bit below the 10V line, but that's just an artifact of a window resize, when I place the cursor on the green line, it's exactly 10V)

• Why is the current displayed as a curve? Is it because the R = 1 + 100 * time expression is incorrect?
• How can i model a real voltage source and current source in SPICE?
• In LTSpice there's a current component as well. Are the Current and Voltage components models of ideal voltage and current sources or real voltage sources
• How would I do to create a simulation that would display a graph resistance vs voltage graph as in the book example at the top of this post?
• I'd suggest to replace " R=1+100*time " by " {1+100*time} " (So, no R= in the value) – Huisman Feb 14 '19 at 20:53
• @Huisman That cannot be done if the quantity is time-related, such as directly using using time, here, because with only the curly braces, LTspice needs to pre-parse and pre-calculate the value of the resistor, and time cannot be pre-calculated. That's why, in this case, it's necessary to use a behavioural resistor, which allows time-dependent variables. – a concerned citizen Feb 16 '19 at 8:06

Why is the current displayed as a curve? Is it because the R = 1 + 100 * time expression is incorrect?

The time is increasing from 0 to 0.1, at 0 time the resistor is 1Ω. When the time reaches the end of the simulation it is R = 1+100*0.1 which is equal to 11 ohms

V/R = I so the relationship would be 1/x which is a function that looks like this:

How can i model a real voltage source and current source in SPICE?

A real voltage source has source resistance (and maybe some inductance) and cannot provide infinite current.

In LTSpice there's a current component as well. Are the Current and Voltage components models of ideal voltage and current sources or real voltage sources

They are ideal, they provide infinite current or infinite voltage. A real source cannot do this and can't provide current instantaneously.

How would I do to create a simulation that would display a graph resistance vs voltage graph as in the book example at the top of this post?

See this post: How do I achieve XY mode on LTspice?

You can also use equations in the graphing window, pressing alt after simulation gives you the power for the component, and there is a way by holding down the voltage probe and dragging to get a differential signal.

After reading the answer from laptop2d and reading more LTSpice tutorials, I found out that I can plot several values of resistance by replacing the resistor with a voltage source and do a DC-sweep. Then V2/I will be the resistor value.

When I use the expression V(Vt)/I(R1), LTSpice even figures out that the unit is resistance! I guess I have to prefix the horizontal axis expression with a minus since V2 is in the opposite direction of V1? I tried rotating V2, but that didn't give me the same curve.