---
title: "Direct programming of a third-order controller"
subject: "Digital Control System"
chapter: 4
key: "semester_6/digital_control_system:direct-programming-6z2-7z"
source: https://www.bctengineer.com/q/semester_6/digital_control_system/direct-programming-6z2-7z
site: BCT Engineering
---

# Direct programming of a third-order controller

Digital Control System · Chapter 4: Design and Compensation of Discrete Time Control System

- Asked in: 2081 Chaitra, 3 marks
- Answer checked by Claude Opus 5.5 (high effort) on 2026-10-14
- Page: https://www.bctengineer.com/q/semester_6/digital_control_system/direct-programming-6z2-7z
- Whole chapter: https://www.bctengineer.com/md/semester_6/digital_control_system/chapter-4

## Question

Realize the given digital controller by direct programming: Y(z)/X(z)=(6z²+7z)/(10z³-6z²+7z+5).

## Short answer

Divide by 10z^3 to get G(z) = (0.6z^-1+0.7z^-2)/(1-0.6z^-1+0.7z^-2+0.5z^-3). Direct programming uses two input delays and three output delays with feedforward gains 0.6, 0.7 and feedback gains +0.6, -0.7, -0.5. Difference equation: y(k)=0.6y(k-1)-0.7y(k-2)-0.5y(k-3)+0.6x(k-1)+0.7x(k-2).

## Answer

**Direct programming** realizes the difference equation exactly as written. It uses one chain of delays for past inputs and another for past outputs.

#### Step 1: Write in powers of $z^{-1}$
Divide the numerator and denominator by $10z^3$:

$$
\frac{Y(z)}{X(z)} = \frac{0.6z^{-1} + 0.7z^{-2}}{1 - 0.6z^{-1} + 0.7z^{-2} + 0.5z^{-3}}
$$

#### Step 2: Difference equation
$$
y(k) = 0.6y(k-1) - 0.7y(k-2) - 0.5y(k-3) + 0.6x(k-1) + 0.7x(k-2)
$$

#### Step 3: Block diagram (direct programming)
```text
x(k)
  o              (S)--------------o--> y(k)
  |               ^               |
[z^-1]            |             [z^-1]
  | x(k-1)        |               | y(k-1)
  o--[0.6]------>(S)<[0.6]--------o
  |               ^               |
[z^-1]            |             [z^-1]
  | x(k-2)        |               | y(k-2)
  o--[0.7]------>(S)<[-0.7]-------o
                  ^               |
                  |             [z^-1]
                  |               | y(k-3)
                  +<[-0.5]--------o
```

- The left delay chain stores $x(k-1)$ and $x(k-2)$. The right chain stores $y(k-1)$, $y(k-2)$ and $y(k-3)$.
- Feed-forward gains are 0.6 and 0.7. Feedback gains are $+0.6$, $-0.7$ and $-0.5$ (the negatives of the denominator coefficients).
- There is no direct path from $x(k)$ to $y(k)$, because the $z^0$ term of the numerator is zero.
- Direct programming needs $m + n = 2 + 3 = 5$ delays. Standard programming would need only 3.

## Check yourself

The answer's key points as multiple-choice questions, with the correct option and why.

1. To get the difference equation for (6z^2+7z)/(10z^3-6z^2+7z+5), what is the first step?
   A. Multiply numerator and denominator by 10z^3
   B. Divide numerator and denominator by 10z^3 to get powers of z^-1 with leading denominator coefficient 1
   C. Factor the denominator
   D. Take the inverse Laplace transform
   Answer: B. Dividing by 10z^3 gives (0.6z^-1+0.7z^-2)/(1-0.6z^-1+0.7z^-2+0.5z^-3), with leading 1 in the denominator. (Key point: Convert to z^-1 form)

2. For denominator 1 - 0.6z^-1 + 0.7z^-2 + 0.5z^-3, the feedback gains on y(k-1), y(k-2), y(k-3) are:
   A. -0.6, +0.7, +0.5
   B. +0.6, +0.7, +0.5
   C. +0.6, -0.7, -0.5
   D. -0.6, -0.7, -0.5
   Answer: C. The feedback gains are the negatives of the denominator coefficients: +0.6, -0.7, -0.5. (Key point: Feedback gain signs)

3. How many delays does direct programming use for this controller (numerator in z^-1 up to z^-2, denominator up to z^-3)?
   A. 3
   B. 2
   C. 6
   D. 5
   Answer: D. Direct programming needs m + n = 2 + 3 = 5 delays, whereas standard programming needs only 3. (Key point: Delay count)

## Close variants set in other exams

- [Direct programming of a third-order controller](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Adirect-programming-6z2-7z-16) — Digital Control System, chapter 4, asked 4×
- [Series programming of a digital controller](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Aseries-programming-controller) — Digital Control System, chapter 4, asked 4×

## Related in Digital Control System

- [Ladder programming of a third-order controller](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Aladder-8z3) — Digital Control System, chapter 4
- [Ladder programming of a third-order transfer function](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Aladder-z3-4z2) — Digital Control System, chapter 4, asked 2×
- [Direct programming of a first-order filter](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Adirect-programming-first-order) — Digital Control System, chapter 4
- [Jury test: 2z⁴+7z³+10z²+4z+1](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Ajury-2z4-7z3) — Digital Control System, chapter 3, asked 8×
- [Ladder programming of a third-order filter](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Aladder-third-order-128) — Digital Control System, chapter 4, asked 2×
- [Series programming of a third-order transfer function](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Aseries-programming-z-plus-1) — Digital Control System, chapter 4, asked 2×

## Related in other subjects

- [Direct form and lattice of FIR, 1+0.7z⁻¹+1.2z⁻²−z⁻³](https://www.bctengineer.com/question.md?key=semester_7%2Fdigital_signal_analysis_and_processing%3Alattice-fir-1-0-7-1-2) — Digital Signal Analysis and Processing, chapter 4, asked 2×
