2
\$\begingroup\$

Is it possible to add a variable into the value of a component in LT spice? I'd like to simulate a resistor divider to look at current consumption but keep the ratio of the resistances the same.

I tried setting R1 to {X} and R2 to {X*1.5} but couldn't get it to work correctly. Haven't found the solution on Google and haven't been able to successfully run it. Maybe I need to define X somewhere.

\$\endgroup\$
3
  • 1
    \$\begingroup\$ Are you saying that a google search of "ltspice parameter" returned nothing? If you tried something then show us what you tried...if it didn't work for you then we won't waste time suggesting the same approach again. \$\endgroup\$ Commented Dec 19, 2021 at 21:38
  • \$\begingroup\$ I had already tried what I mentioned, should've said that and updated post to show that. \$\endgroup\$
    – Pete
    Commented Dec 19, 2021 at 21:50
  • 1
    \$\begingroup\$ @Pete Yes, you need to define X!! Use the .param card. Look it up in the help. While you are at it, look up the .func card, as well. And type in 'user-defined functions' into the help, as well. It's a short summary. \$\endgroup\$
    – jonk
    Commented Dec 19, 2021 at 22:01

1 Answer 1

2
\$\begingroup\$

R1 won't accept 1.5*Rx directly but it can be assigned to a variable. Rx can be used in the .step param statement.

enter image description here

\$\endgroup\$
2
  • \$\begingroup\$ Why did you say "R1 won't accept 1.5*Rx directly"? It sure can. The curly braces are needed to enclose the value and tell SPICE to perform an evaluation, since a resistor (not a behavioural one, like your R1) can only accept numeric literals as values. \$\endgroup\$ Commented Dec 20, 2021 at 18:31
  • \$\begingroup\$ @aconcernedcitizen Thanks for sharing your knowledge. I typed 1.5* Rx in the box directly and it didn't accept it (obviously) so I used this method which is redundant. \$\endgroup\$
    – Syed
    Commented Dec 20, 2021 at 19:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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