Math Puzzle...

Jul 06, 2013 176 Replies

Math Puzzle...



How do you evaluate this function:



LIMIT (0, F(x), 120)



I know the answer. I just want to see what other people think. ...Jim Thompson



-- | James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at

formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.


Since when is some random SPICE thing math? ;)

Software is entirely arbitrary, so if one hasn't used it before, HCLIU.

Cheers

Phil Hobbs

Dr Philip C D Hobbs Principal Consultant ElectroOptical Innovations LLC Optics, Electro-optics, Photonics, Analog Electronics 160 North State Road #203 Briarcliff Manor NY 10510 USA +1 845 480 2058 hobbs at electrooptical dot net http://electrooptical.net

What it says. It clamps.

formatting link

Note that VA and VB are identical.

I wonder if equations are pre-compiled or interpreted. They do slow things down.

Whats F(x) ;)

If it's = x, then the limit as x goes from 0 to 120 is 120. I gather that this is what is implied by the equation.

But I could be wrong. I'm used to seeing more defined functons eg; f(x)=4x^2+3x+2

Cheers

That's what I said. I'm trying to figure out how you felt that calculates average power.

...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

looks like a bug.

having never encountered it in detail before I'd expect limit(a,b,c) to do ac : c else : a so LIMIT (0, F(x), 120) F(X) > 0 : F(x) else : 0

?? 100% natural --- news://freenews.netfront.net/ - complaints: news@netfront.net ---

If 0 < F(x) < 120 : F(x)

If F(x) < 0 : 0

If F(x) > 120 : 120

How Larkin parleyed that into calculating average power I have no clue. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Where did you say that? Not in this thread. You just did your usual content-free dancing around.

I'm trying to figure out how you felt that

I calculated realtime efficiency as a graphable voltage, 100 * Pout/Pin, then clamped the result to between 0 and 100 (or in another situation, 0 and 120 just to see the overshoot). The clamp is there because sometimes I'd get absurd picosecond startup transient spikes, like -14 teravolts, division by zero sorts of things, which would blow through my lowpass filter. LT Spice would scale all the voltage graphs accordingly.

Adding 1 milliwatt to Pin fixed the math excursion, but LIMIT is better. LIMIT is interesting, the "intermediate value" function. It's easy to remember because you can enter the three arguments in any order.

Iout and Iin were lowpass filtered to make the current and power values realistic and reasonably graphable. The efficiency result was filtered a bit too, to get smooth graph lines. All that adds a little time lag, not important to me. I could use higher order filters if the lag bothers me, but it would clutter up my schematic.

You got a problem with any of that?

In LT Spice, LIMIT (x,y,z) returns the intermediate, "middle" value of the three args. They can be placed in any order. If two are constants and one is F, it returns F clamped to the limits declared by the two constants. It's handy to keep values from getting crazy, which they sometimes do in Spice.

Yeah, that seems to happen a lot lately, the part about having no clue. Most people would ask for clarification; not you.

well: that's what the docuentation which I could find said would happen.

formatting link

apparently limit really computes the median of it's three inputs and returns that.

?? 100% natural

Cannot be evaluated as F(x) is unknown.

Even though I've known of you for years, you never fail to astonish me with your stupidity. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Still zero content. You've lost it, you nasty old git.

So tell us, oh great master! ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Nope, NOT precisely median, unless you mean a vague term "middle" value.

"In statistics and probability theory, the median is the numerical value separating the higher half of a data sample, a population, or a probability distribution, from the lower half."

From PSPCREF (it's PSpice, you know :-)...

LIMIT(x,min,max) result is min if x < min, max if x > max, and x otherwise

From SCAD4 Manual...

limit(x,y,z) Intermediate value of x, y, and z

which is what I said above. So it clips data.

Larkin uses it to discard data he doesn't like...

"It's handy to keep values from getting crazy, which they sometimes do in Spice."

I'm still waiting for an answer from Larkin of how that computes efficiency, but I'm not holding my breath. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Produce some facts instead of name-calling. You're a fraud. And NOLA white trash to boot ;-) ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

For calculating such things as "efficiency", easy in PSpice (AVGX in the Probe viewer), difficult in LTspice, I got the following information from Helmut (moderator of the LTspice list)...

Hello Jim.

Unfortunately it's not possible to directly define a formula with integration in the waveform viewer. One has to make a Bv-source in the schematic or netlist.

.param d=100u .func avgx(x,d) {(idt(x)-delay(idt(x),d))/d}

BV1 avgout 0 V=avgx(V(out),d)

BV2 avg37 0 V=avgx(V(37),d)

By the way you don't need a Bv-symbol. You could directly add these SPICE-lines from above to your schematic. You will need one B-device SPICE-line for every item you want to average.

I tried an example and found it's necessary to define a small max time step in .TRAN and to switch off data compression for best results.

.options plotwinsize=0 ; data compression off

The text after ';' is only comment.

Best regards, Helmut ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

*if* F(x) has a uniform distribution, don't you get average? or it F(x) is at least symmetrical about the average, too.

F(x) is actually F(t)... it's moving all the time in the simulation. ...Jim Thompson

| James E.Thompson | mens | | Analog Innovations | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | San Tan Valley, AZ 85142 Skype: Contacts Only | | | Voice:(480)460-2350 Fax: Available upon request | Brass Rat | | E-mail Icon at http://www.analog-innovations.com | 1962 | I love to cook with wine. Sometimes I even put it in the food.

Join the Discussion

Have something to add? Share your thoughts — no account required.

Didn't find your answer?

Ask the community — no account required