Given the following difference equation
$$y[n]-\left(\dfrac{n}{n+1}\right)y[n-1] = n\cdot x[n]$$
How can we use MATLAB to solve it?
I know if the coefficients are constant we can simply use filter(b, a,x), but not sure how to do it with variable coefficients.
y(1) = -1;
x = randn(1,100);
for n = 2:100
y(n) = n*x(n) + (n/(n+1))*y(n-1);
end
$\endgroup$ – GKH Jan 31 '20 at 21:03