| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
Didn't find your answer? Ask the community — no account required.
J
Jim Thompson
[snip]
-(1-Decimal) or equivalently Decimal-1
So the result is a _sawtooth_.
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
J
Jim Thompson
"Integer.Decimal" is always a positive number.
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
J
Jim Thompson
[snip]
There is INT and IF, but IF is useful only where it's not useful ;-)
I just came up with this while having a mac-n-cheese lunch with my
3-year-old grand-daughter:
(Integer.Decimal) - Round(Integer.Decimal)
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
J
Jim Thompson
I need it valid for 0 1G ;-)
...Jim Thompson
-- | James E.Thompson, P.E. | mens | | Analog Innovations, Inc. | et | | Analog/Mixed-Signal ASIC's and Discrete Systems | manus | | Phoenix, Arizona Voice:(480)460-2350 | | | E-mail Address at Website Fax:(480)460-2142 | Brass Rat | |
formatting link
| 1962 | I love to cook with wine. Sometimes I even put it in the food.
S
Spehro Pefhany
Do you mean this, or do you mean -(Decimal-1), which would be a continuous inverted-V-shaped function?
If the latter, then maybe something like
0.5 - sqrt((x-0.5)^2)
Best regards, Spehro Pefhany
"it's the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
S
Spehro Pefhany
Does it have to be valid (and is it defined) as above for x < 0 and x > 1 as well?
Best regards, Spehro Pefhany
"it's the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
S
Spehro Pefhany
FRACT(X + 0.5) -0.5
is valid/differentiable for -0.5 < x < 1.5
....not good enough?
Best regards, Spehro Pefhany
"it's the network..." "The Journey is the reward"
speff@interlog.com Info for manufacturers: http://www.trexon.com
Embedded software/hardware/analog Info for designers: http://www.speff.com
D
Don Taylor
....
Looks like you might have a sign function to work with.
So I look at you having two different behaviors, one on each side of 1/2 and think of using the sign function to tease these apart.
I'm assuming that SGN is your sign function and is +1 when the argument is positive and -1 when it is negative. So if I'm right
(SGN(x-1/2)+1)/2 will be +1 for x > 1/2 and 0 elsewhere
-(SGN(x-1/2)-1)/2 will be +1 for x < 1/2 and 0 elsewhere
Now you want a line y=x-1 for x > 1/2 and you want a line y=x for x < 1/2.
Assemble all the bits
(SGN(x-1/2)+1)/2*(x-1)-(SGN(x-1/2)-1)/2*x
Then throw it at Derive (free 30 day trial at
formatting link
and do a plot of the result to make sure it does what I wanted, discover I had swapped a + and - initially, corrected above. And, then just for grins I tap the Simplify button to ask it if it knows of a simpler form. It responds with (actually Derive uses SIGN, not SGN):
x-1/2-SGN(2*x-1)/2
hummm... which with a few moments thought seems to be
x-1/2-SGN(x-1/2)/2
which I throw back at Derive just to make sure my brain cells haven't completely failed, and all three plots are the same sawtooth.
If I think about the final version for a moment I realize it is a line with the same slope as the one you desire, positioned midway between the two lines you wanted, and they are using SGN to either add or subtract 1/2 to give the desired vertical offset. Cute, I didn't think of that one.
I hope this helps. If you need more fiddling with this let me know and I'll try to think up some alternative solutions.
H
Helmut Sennewald
"Jim Thompson" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...
Hello Jim, I will express it in a general form.
IF (number-INT(number) > 0.5 THEN result = -( INT(number) + 1 - number ) ELSE result = number - INT(number)
I assume there is an INT-function and an IF-function in PSPICE.
Best Regards, Helmut
H
Helmut Sennewald
"Jim Thompson" schrieb im Newsbeitrag news: snipped-for-privacy@4ax.com...
Hello Jim, this is mostly the same, but your wish was:
That might be the answer, BUT with NEARLY ideal diodes.
My expression, N - Round(N), works by itself, but the sharp discontinuities cause insurmountable convergence issues.
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
F
Fred Bloggs
Nah- it is fundamentally a discontinuous function and that rules out linear analog computation. Going back to the less obvious algebra where a simple guess will not suffice yields the following argument: View in a fixed-width font such as Courier.
x==LIM F(Y)=F(X) i.e. F(X) "left" continuous Y->X(-)
o== right limit discontinuity
F(X)= (X-0.5) MOD (0,1] -0.5 , modulo a half-open interval
FRACT(Y)= Y MOD [0,1) and 1-FRACT(-Y)=Y MOD (0,1]
Then F(X)= 1-FRACT(0.5-X)-0.5= 0.5- FRACT(0.5-X)
CHECK: EACH INTEGER n>=0, FRACT (-(n+0.5))=0.5 AND 0.5-0.5=0
EACH INTEGER n+y 0
J
Jim Thompson
So?
The real issue turns out to be differentiability.
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
K
Ken Smith
LTSpice has FLOOR built in and it is faster than using TAN to get there.
--
kensmith@rahul.net forging knowledge
D
Don Taylor
It seems that all those functions are going to have differentiability problems.
If you have do have access to the functions used to define those then
-ATAN(K*(X-1/2))/PI+X-1/2
seems to approximate what you want and is a smooth function, where K is a positive constant, the larger you make it the closer you are to a sawtooth but the larger the negative spike the derivative will have. K perhaps somewhere between 10 and 40 might serve your purposes.
Or, if you have hyperbolic tangent, or can build it from e^x, then
-TANH(K*(X-1/2))/2+X-1/2
also seems to approximate what you want and is a smooth function.
And, if I understood your earlier comment, that you wanted your function to linearly increase for increasing x, then either of these satisfy that, unlike x-ROUND(x) that is a sawtooth repeating over and over and not increasing beyond x=1.
J
Jim Thompson
Sawtooth _repeating_ IS what I want.
But I do have TANH available.
Thanks for the pointer.
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| http://www.analog-innovations.com | 1962 |
I love to cook with wine. Sometimes I even put it in the food.
J
Jim Thompson
Aha! Sweet! Thanks! Nice and smooth! Now I'll try closing the loop :-)
...Jim Thompson
| James E.Thompson, P.E. | mens |
| Analog Innovations, Inc. | et |
| Analog/Mixed-Signal ASIC's and Discrete Systems | manus |
| Phoenix, Arizona Voice:(480)460-2350 | |
| E-mail Address at Website Fax:(480)460-2142 | Brass Rat |
| 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
Report Content
You are reporting this content to the moderators. They will look at it
ASAP.