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:


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?


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


| improve this answer | |

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.