Post Reply 
Inquiry Equation on Symbolic and Numeric View
06-15-2022, 11:13 AM
Post: #1
Inquiry Equation on Symbolic and Numeric View
Hi All.
I wrote a small program to record my favorite electronics equations and formulas and fill in the E1-E0.

For completenes there is a simple equation for the OPAmps that is like this:

   

So if V1 is greater than V2 then Vout = V+.

I know how to do this with programming using IF statements, but I wanted to reproduce this in one of the E1-E9 variables. Is this possible?

I know its a very simple equation but I really wanted to have it there for completeness.

Thank you!
Find all posts by this user
Quote this message in a reply
06-15-2022, 01:54 PM
Post: #2
RE: Inquiry Equation on Symbolic and Numeric View
I think you might be looking for the PIECEWISE function:

Syntax:
PIECEWISE(test1, case1, ...[, test8], case8)

Used with Home settings Entry set to Algebraic to enter a piecewise-defined function in the Function app Symbolic view (among other uses). Takes as arguments pairs, each of which consists of a condition that defines a sub-function domain and an expression that defines the sub-function. Each of these pairs defines a sub-function of the piecewise
function and the domain over which it is active.

If used with Home settings Entry set to Textbook or if accessed via the Template menu, then the syntax varies slightly and is restricted to two pieces.

Syntax :
{case1 if test1

{case8 [if test8]

Example:
PIECEWISE(X<-4,X,-4≤X AND X<2, X+1, X≥2,X+2) as F1(X) in the Symbolic view of the Function app appears as:

X if X<-4
F1(X)= X+1 if -4≤X AND X<2
X+2 if X≥2

In Plot view, the graph of two rays and a segment is drawn.
Find all posts by this user
Quote this message in a reply
06-15-2022, 02:20 PM
Post: #3
RE: Inquiry Equation on Symbolic and Numeric View
(06-15-2022 11:13 AM)wmundstock Wrote:  So if V1 is greater than V2 then Vout = V+.

I know how to do this with programming using IF statements, but I wanted to reproduce this in one of the E1-E9 variables. Is this possible?

First I don't think you can have variable names with + or - inside.
Then you need to first create the different variables you're using in the equation if they are not predefined.
This being said you can write the equation this way:

Vout=IFTE(V1>V2,Vsp,Vsm)

which means: IF V1>V2 THEN Vout=Vsp ELSE Vout=Vsm where Vsp stands for Vs+ and Vsm for Vs-.
Find all posts by this user
Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)