How to use this calculator
Find the first optimal digital command when only a fixed number of future moves remain.
- Enter Discrete state coefficient a, Input coefficient b, State cost q, Input cost r, then complete the remaining labeled fields. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Finite horizon scalar digital regulator explained
How the calculation works
P_N=s; Kₖ=bPₖ₊₁a/(r+b²Pₖ₊₁); Pₖ=q+a²Pₖ₊₁−a²b²Pₖ₊₁²/(r+b²Pₖ₊₁).
Work backward from the terminal penalty; each stage chooses its own gain. The displayed gain is for the beginning of the horizon.
Set up the calculation
a— Discrete state coefficient a- State multiplier per discrete update.
b— Input coefficient b- State change per input unit per update.
q— State cost q- Per-update state-square penalty.
r— Input cost r- Positive per-update input-square penalty.
s— Terminal cost s- Final state-square penalty.
n— Control horizon (updates)- Number of future actuator decisions. Enter a whole number.
x— Current state- State at the start of the horizon.
Limits of this model
Unconstrained scalar discrete dynamics, no reference trajectory, and no receding-horizon constraint handling.
Check this example
Discrete state coefficient a = 1.1; Input coefficient b = 0.5; State cost q = 1; Input cost r = 0.2; Terminal cost s = 4; Control horizon (updates) = 8; Current state = 2.
- First optimal gain: 1.482278 input/state
- First command: -2.964556 input units
- Minimum horizon cost: 6.608809 cost
A slightly unstable sampled plant has eight remaining moves and terminal penalty four; evaluate the first command from state two.
Reading the outputs
The first gain and command apply now; total cost includes every stage and the terminal state.
Frequently asked questions
Is the gain constant through the horizon?
Generally no; the terminal boundary makes it time dependent.
What if all state penalties are zero?
Then zero control minimizes the positive input cost.
Can this represent a continuous horizon?
No. a and b must already describe a discrete update.
How do I use the Finite horizon scalar digital regulator calculator?
Enter Discrete state coefficient a, Input coefficient b, State cost q, Input cost r, then complete the remaining labeled fields. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Finite horizon scalar digital regulator?
Discrete state coefficient a = 1.1; Input coefficient b = 0.5; State cost q = 1; Input cost r = 0.2; Terminal cost s = 4; Control horizon (updates) = 8; Current state = 2. First optimal gain: 1.482278 input/state First command: -2.964556 input units Minimum horizon cost: 6.608809 cost A slightly unstable sampled plant has eight remaining moves and terminal penalty four; evaluate the first command from state two.
Background or definition reference: MathWorks LQR defining equations.
Read our calculation methodology.