# Casual & Stable

Given the following difference equation:

y(k) = .6y(k-1) – .05y(k-2) + 2x(k) + x(k-1),               y(1) = 2, y(2) = 3

x(k) = .8 k+1 u(k)

1. Use Matlab to plot the full response y(k).
1. Use the Matlab function filter to plot y(k) and compare the results.
1. Is the system causal?
1. Is the system stable?

Solution

for i=-10:10

x(i+11)=exp(i*(-0.1+0.3i)); % since matlab indices can’t be negative, to make it >0, adding 11 to it to startthe index from 1

end

%absolute value

subplot(2,2,1);

plot(abs(x),’-o’);

grid on;

xlabel(‘Index’);

ylabel(‘Absolute value’);

title(‘Absolute value of signal’);

%phase

subplot(2,2,2);

plot(phase(x),’-o’);

grid on;

xlabel(‘Index’);

title(‘Phase of signal’);

%real part

subplot(2,2,3);

plot(real(x),’-o’);

grid on;

xlabel(‘Index’);

ylabel(‘Value of real part’);

title(‘Real part of signal’);

%Imaginary part

subplot(2,2,4);

plot(imag(x),’-o’);

grid on;

xlabel(‘Index’);

ylabel(‘Value of imaginary part’);

title(‘Imaginary part of signal’);