--
| 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.
--
| 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.
--
| 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.
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.
-- | 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.
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
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
--
"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
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.
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.
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.
--
| 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.
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.
--
| 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.
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.
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here.
All logos and trade names are the property of their respective owners.