Post Reply 
Solver (17BII, 27S, etc) equation with multiple outputs
02-18-2023, 09:49 AM
Post: #1
Solver (17BII, 27S, etc) equation with multiple outputs
Hi

I've read and mostly understand the detailed explanation of the Solver in the Technical Application manual, but there's a form of equation I'm struggling to get right. The intention is a single equation that can calculate an output in two possible, equivalent forms.

An example. An amplifier has gain which can be expressed as a multiple of voltage:
Vgain = Vout / Vin

But can equivalently be expressed in dB, like this:
dBgain = 20 x log(Vgain)

My Solver equation is:
DBGAIN=20xLOG(L(VGAIN:VOUT/VIN))+0xVGAIN

I can input Vin and Vout, and calculate dBgain just fine. But if I press Vgain in the solver, it says "solution not found", even though it must have calculated Vgain as an intermediate result in the calculation.

What am I doing wrong?

Thanks
Rob

Rob
35, 12C, 17BII, 27S, 28S, 32SII, 48G, 49G, 50G, 35S.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-18-2023, 09:58 AM (This post was last modified: 02-18-2023 01:28 PM by robjordan.)
Post: #2
RE: Solver (17BII, 27S, etc) equation with multiple outputs
As often the case, asking the question prompted me to dig in again, and I have something working now, by including two "0x" terms, thus:

DBGAIN=20xLOG(VGAIN)+0xL(VGAIN:VOUT/VIN)+0xVGAIN

Rob
35, 12C, 17BII, 27S, 28S, 32SII, 48G, 49G, 50G, 35S.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-21-2023, 02:08 PM
Post: #3
RE: Solver (17BII, 27S, etc) equation with multiple outputs
Generally speaking, I've seen two approaches to creating multi-output equations. It should be noted that this is multi-output - I haven't seen a good way to select from multiple possible sets of inputs in a single equation.

1. Use the L() function to set the value of an auxiliary variable which you can RCL after solving. Your initial formula is a good example:

DBGAIN=20xLOG(L(VGAIN:VOUT/VIN))+0xVGAIN

You can solve for DBGAIN, VOUT, or VIN, and after solving, you can press RCL VGAIN to see the voltage gain. Solving for VGAIN directly will not work, and VGAIN also can't be used as an input here.

2. Use the S() function to check which variable is being solved for and react accordingly. For instance, this equation lets you solve for either DBGAIN or VGAIN:

IF(S(DBGAIN):DBGAIN=20*LOG(VOUT/VIN):VGAIN=VOUT/VIN)

You can also solve for VOUT or VIN, but only by using VGAIN as one of the inputs.

The third alternative, which isn't really a multi-output equation at all, is to simply store multiple equations. Smile

VGAIN=VOUT/VIN
DBGAIN=20*LOG(VOUT/VIN)

Variables will be shared between equations as long as the names are consistent, so this is often a good solution. It's like the HP 48 multiple-equation solver, but you have to figure out which equations need to be solved to get all the variables you need. Wink
Visit this user's website Find all posts by this user
Quote this message in a reply
02-21-2023, 03:34 PM
Post: #4
RE: Solver (17BII, 27S, etc) equation with multiple outputs
Dave,

Thanks very helpful! I forgot that you can retrieve intermediate values using RCL.

I like your second approach best though, using the S() expression. The equation as you wrote it didn't validate at first, but then I figured, from reading the Don Shepherd additional material in Martin Hepperle's version of the Solver documentation, that the expressions in the two branches of the S() should be treated as having an implicit =0. So instead of writing "DBGAIN=20*LOG(VOUT/VIN)", you have to write "20*LOG(VOUT/VIN)-DBGAIN". In full:

GAIN:IF(S(DBGAIN):20×LOG(VOUT/VIN)-DBGAIN:(VOUT/VIN)-VGAIN)

Thanks again
Rob

Rob
35, 12C, 17BII, 27S, 28S, 32SII, 48G, 49G, 50G, 35S.
Visit this user's website Find all posts by this user
Quote this message in a reply
02-21-2023, 04:30 PM
Post: #5
RE: Solver (17BII, 27S, etc) equation with multiple outputs
(02-21-2023 03:34 PM)robjordan Wrote:  Dave,

Thanks very helpful! I forgot that you can retrieve intermediate values using RCL.

I like your second approach best though, using the S() expression. The equation as you wrote it didn't validate at first, but then I figured, from reading the Don Shepherd additional material in Martin Hepperle's version of the Solver documentation, that the expressions in the two branches of the S() should be treated as having an implicit =0. So instead of writing "DBGAIN=20*LOG(VOUT/VIN)", you have to write "20*LOG(VOUT/VIN)-DBGAIN". In full:

GAIN:IF(S(DBGAIN):20×LOG(VOUT/VIN)-DBGAIN:(VOUT/VIN)-VGAIN)

Thanks again
Rob

Oops, my mistake. Forgot you couldn't put = inside the IF() function like that. Smile But yes, any equation without = in it is treated as solving for zero, so you can just subtract one side from the other like you've demonstrated.

I've also taken advantage of that behavior to make unit conversion formulas where you can input any one variable and solve for any other, e.g.:

.0254*(IF(S(IN):-1:1)*IN+IF(S(FT):-1:1)*FT*12+IF(S(YD):-1:1)*YD*36+IF(S(MI):-1:1)*MI*63360)+IF(S(MM):-1:1)*MM/1000+IF(S(CM):-1:1)*CM/100+IF(S(M):-1:1)*M+IF(S(KM):-1:1)*KM*1000

Essentially, use S() to multiply the variable you're solving for by -1 to isolate it from all the other variables. Make sure you do CLEAR DATA to zero out all the unused variables first, or it will convert the sum of all the entered variables to the one you're solving for. (Though maybe that's what you want at times!)
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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