I'm leaving this question as fairly general, as I run into this sort of problem frequently and I think that I could set up LTspice to solve it for me. I have a relatively simple comparator circuit (let's assume an LT6703 for now, but it could be any comparator) where the positive input is connected to the output of a voltage divider, and the negative input is connected to some fixed voltage reference. To prevent oscillation, I also have a hysteresis feedback resistor.I want the output of the voltage divider to indicate when the input to the voltage divider (V3) goes above some desired voltage. This is all fairly textbook.
It gets messy when I need to identify values for resistors R1-R3 to get the switching point as close as possible to my target for V3, with the hysteresis within some bounds, etc.
My thought is to use three .step directives to step R1-R3 through a set of candidate values (say, a subset of E96 resistor values) in a simple simulation that sweeps V3 across the target threshold voltage. I can then define a parameter that should be maximized at the "best" values for R1-R3, and it should be straightforward to identify the maximum value of this parameter value function over all of the configurations that the .step directive step through.
My question is, how do I identify the values of R1-R3 that produced that maximum value?
