Aim
To write and perform a MATLAB program to study the discrete systems represented with its difference equation.
Problem Statement
For a given LTI system represented with its difference equation:
y(n) = 0.5 * y(n-1) + x(n) + x(n-1), where x(n) = u(n)
Find the system output for 0 ≤ n ≤ 50. Assume initial conditions:
y(0) = 0, y(1) = 1
Theory
The given system is a first-order difference equation with a feedback term. The output at time n depends on the previous output value (y(n-1)), the current input value (x(n)), and the previous input value (x(n-1)).
A common method to solve this type of system is to use the recursive relationship provided in the equation and iterate over the time indices.
MATLAB Code
Expected Output
The MATLAB code generates two plots:
- System Input (x(n)): A constant input signal, u(n) = 1, plotted over the time range.
- System Output (y(n)): The output of the system based on the recursive difference equation, showing how the system evolves over time.
The plots will visually illustrate how the discrete-time system processes the input signal and produces an output.