1
\$\begingroup\$

I would like to create a variable resistor as following:

R2=1 if i(R2)<1
R2=2 if 1<i(R2)<10
R2=3 if i(R2)>10

I know that the syntax is:

R=if(condition,valueiftrue,valueiffalse)

What if I have three intervals?

The .asc file and the IF statement law is also shown below.

What is the correct syntax to do that?

\$\endgroup\$
2
\$\begingroup\$

Then you can either

  1. Create a B source with the conditional statements and an additional signal (which is useful for debugging)

  2. Nest the if statements

    if(condition,valueiftrue,if(condition,valueiftrue,valueiffalse))

| improve this answer | |
\$\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.