---
title: "Direct programming of a first-order filter"
subject: "Digital Control System"
chapter: 4
key: "semester_6/digital_control_system:direct-programming-first-order"
source: https://www.bctengineer.com/q/semester_6/digital_control_system/direct-programming-first-order
site: BCT Engineering
---

# Direct programming of a first-order filter

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

- Asked in: 2071 Bhadra, 5 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-first-order
- Whole chapter: https://www.bctengineer.com/md/semester_6/digital_control_system/chapter-4

## Question

Construct the block diagram for the following pulse-transfer function system (a digital filter) by direct programming: G(z)=(2-0.6z⁻¹)/(1+0.5z⁻¹).

## Short answer

Direct programming uses the difference equation y(k)=-0.5y(k-1)+2x(k)-0.6x(k-1). The block diagram has feedforward gains 2 and -0.6, feedback gain -0.5, and two delay elements.

## Answer

#### Step 1: Difference equation
$$
\frac{Y(z)}{X(z)} = \frac{2 - 0.6z^{-1}}{1 + 0.5z^{-1}} \;\Rightarrow\; Y(z)(1 + 0.5z^{-1}) = X(z)(2 - 0.6z^{-1})
$$

$$
y(k) = -0.5y(k-1) + 2x(k) - 0.6x(k-1)
$$

#### Step 2: Direct programming block diagram
Each delayed input and output term is formed with its own delay element and added in a summer:

```text
x(k)
  o--[2]-------->(S)--------------o--> y(k)
  |               ^               |
[z^-1]            |             [z^-1]
  | x(k-1)        |               | y(k-1)
  o--[-0.6]----->(S)<[-0.5]-------o
```

- Feed-forward: $x(k)$ with gain 2, and $x(k-1)$ with gain $-0.6$.
- Feedback: $y(k-1)$ with gain $-0.5$.
- Direct programming uses $1 + 1 = 2$ delays.

For comparison, standard programming needs only one delay:
$w(k) = x(k) - 0.5w(k-1)$ and $y(k) = 2w(k) - 0.6w(k-1)$.

The pole at $z = -0.5$ is inside the unit circle, so the filter is stable.

## Check yourself

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

1. From G(z) = (2 - 0.6z^-1)/(1 + 0.5z^-1), the difference equation is:
   A. y(k) = 0.5y(k-1) + 2x(k) - 0.6x(k-1)
   B. y(k) = -0.5y(k-1) + 2x(k) - 0.6x(k-1)
   C. y(k) = -0.5y(k-1) + 2x(k) + 0.6x(k-1)
   D. y(k) = -0.5y(k-1) + 2x(k-1) - 0.6x(k)
   Answer: B. Cross-multiplying gives y(k) + 0.5y(k-1) = 2x(k) - 0.6x(k-1). (Key point: Difference equation)

2. How many delays does direct programming use here, compared with standard programming?
   A. 1 for direct, 2 for standard
   B. 2 for direct, 1 for standard
   C. 2 for both
   D. 1 for both
   Answer: B. Direct programming uses one delay for input and one for output (1+1 = 2); standard needs only 1. (Key point: Delays in direct programming)

3. The pole of the filter is at z = -0.5. What does this say about stability?
   A. Unstable, because it is negative
   B. Stable, because it is inside the unit circle
   C. Marginally stable
   D. Cannot be decided
   Answer: B. |z| = 0.5 < 1, so the pole is inside the unit circle and the filter is stable. (Key point: Stability)

## Related in Digital Control System

- [Pulse transfer function with first order hold](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Afoh-system-pulse-tf) — Digital Control System, chapter 3
- [Observable canonical form of (0.3z⁻¹+0.6z⁻²)/(1−0.2z⁻¹+0.5z⁻²)](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Aocf-0-3-0-6) — Digital Control System, chapter 5, asked 13×
- [Transfer function of first order hold](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Afoh-transfer-function) — Digital Control System, chapter 1, asked 7×
- [Pulse transfer function of digital PID controller](https://www.bctengineer.com/question.md?key=semester_6%2Fdigital_control_system%3Aderive-pid-pulse-tf) — Digital Control System, chapter 3, 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×
- [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×

## Related in other subjects

- [Block diagram of digital communication system](https://www.bctengineer.com/question.md?key=semester_5%2Fdata_communication%3Ablock-diagram-digital-comm) — Data Communication, chapter 1, asked 8×
- [Armature-controlled DC motor transfer function and block diagram](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Atf-armature-dc-motor) — Control Systems, chapter 2
- [PID controller block diagram, transfer function, characteristics](https://www.bctengineer.com/question.md?key=semester_3%2Fcontrol_systems%3Apid-bd-tf-characteristics) — Control Systems, chapter 7
- [Digital data acquisition system block diagram](https://www.bctengineer.com/question.md?key=semester_4%2Finstrumentation_i%3Adigital-data-acquisition-system) — Instrumentation I, chapter 6
