Need help with a circuit

I need a circuit that can perform the following

if (x < -1) x = 0 else if (x < 1) x = sqrt(1 - (x^2)) else x = 0

Now what I have done so far is the comparisons and have three comparators so at a given x the appropiate values are given (1, -1, 0). I have taken care of the square root, minus, and the square part as well.

So, does anyone know what I use and how to do the if then else parts?

3 outputs and only one is needed at the input to the rest of the circuit. I don't want a specialized ic for this so its just or, not, and, xor, etc...

Thank you. :)

Reply to
Dark Alchemist
Loading thread data ...

Well, the posibilities of x would be a sine wave (for this test but could be anything in reality).

If x

Reply to
Dark Alchemist

--- If we assume that x is a voltage which varies over some range and that you want to know when the voltage is less than or equal to 0 volts and also when it's less than 1 volt, then you can set up two voltage comparators like this:

+2V | Vcc [10.0K] | | [10K] +----|+\ | | | >--+-->B x>---+---------|-/ | | Vcc | [10.0K] | | | [10K] +---------|+\ | | | >--+-->A +----|-/ | GND and your truth table will look like this:

x A B

--------+-----+----- ---+--[10K]--------|-/ | | | Vcc | | [10.0K] | | | | [10K] +--B +--[10k]--------|+\ | and Y---+ | | | >--+-------A | | +----|-/ | | | | | GND +---------E--------+ | | | +------------------------>x| y = sqrt(1-x²) |-->y | | +------------------+

Where the line coming down from the AND would be an enable. When x was less than 0V it would go low, disabling the function machine, then when x was between 0V and 1V it would go high to enable the function machine, and when x rose to higher than 1V it would disable it again for as long as x remained higher than 1V.

-- John Fields

Reply to
John Fields

Hmmm, I was able to get all the way to the last part on my own but even looking at what you did (where I see an and gate) I am lost.

So, I have two ouputs (A, B) and your logic table works. Now all I need to do is take the A AND B = 0 or 1 in this instance. I noticed that 0

Reply to
Dark Alchemist

It seems like your equations should use a different variable name for the output of the function. For example: if (x

Reply to
Bob

Hmmm, I am not grasping beyond the and part from what he was telling me. :( We have A && B then what? From this point on is where I got lost.

Reply to
Dark Alchemist

So, was my simplification still holding the same as the original? Btw, thank you everyone for you help. :)

Reply to
Dark Alchemist

Suppose you had two comparators.

One would would output a high (or low if you prefer) when X

Reply to
Bob

--
Yes, that's essentially what I've done by ANDing the comparator
outputs and giving you that AND as an enable.  Not knowing what your
square-rooter-subtractor circuitry looks like, that was as far as I
could go.  If you can perform the ANDing in your computational
circuitry, go for it!
Reply to
John Fields

That's very good! But you'd need an analog multiplier that works at DC if you go there. John simply used A && B as an enable, a much better approach.

--
Best Regards,
Mike
Reply to
Active8

I am tinkering with a strictly opamp solution but I need some idea of the DC accuracy you need, and the settling time or maximum frequency you intend ot pass through this function. Keep in mind that at +-1 volt in, the gain is infinite.

--
John Popelish
Reply to
John Popelish

They turn the sqrt circuit on or off. Off would be x < 0 OR x > 1. So when the sqrt is off, it should output zero.

My point was that if you try to do (A && B) * sqrt, the * implies analog multiplication wheras && or AND is digital multiplication.

Now you can analog multiply sqrt with 1 or 0, the circuitry won't be as simple, however. So use A && B as a control, i.e., an enable.

I still think that you coming up with (A AND B) * sqrt(1-x^2) was very good. It's true.

--
Best Regards,
Mike
Reply to
Active8

--- Dunno, for sure...

Modifying the circuit a little and looking at the circuit and the truth table, we have:

+2V | Vcc [10.0K] | | [10K] +----|+\ | | | >--+----+ x>---+--[10K]--------|-/ | | | Vcc | +-------+ | [10.0K] | | 0V---|b | | | [10K] +--B | _ | +--[10k]--------|+\ | and AB------|a/b y|---y | | | >--+-------A | | | +----|-/ +----|a | | | | +-------+ | GND | S1 | | | | | +-------+ +-------+ | 1V--|1 | +----------------+ | | +------+ | 1-x²|--|1-x² sqrt(1-x²)|--+ +--|x x²|--|x² | +----------------+ +------+ +-------+ The blocks on the bottom are your circuits, and sqrt(1-x²) is shown as being routed through a switch where the output (y)is either sqrt(1-x²) or 0, depending on whether is x is 1V.

The AND gate only goes true when 0V

Reply to
John Fields

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.