I'm trying to solve a pair of difference equations for an economic problem. It appears from the web that the appropriate matlab command is filter(). Indeed, there is at least one
on using filter to solve such problems, but I find the answer provided completely baffling. I think the reason for my bewilderment is that I don't know what an input signal is, at least in the context of this and other threads, or what it means to filter signals, or what signal processing is about.
The help command for filter is equally baffling, to a dummy like me who cannot understand the relationship between solving a simple difference equaztion system and signal processing. The help command for filter2 is even more unhelpful, if that's possible.
For example, I want to use filter (or maybe filter2??) to solve the following trivial optimal control problem, for t = 1, ... ,3
y(t+1) = 1.1y(t) - x(t) (1), where y is the state variable and x is the control
x(t+1) = 1.1*x(t) (2)
y(1) = 1 Initial condition
y(4) = 1.21 Terminal condition
That is, I need to compute y(2:3) and x(1:3) that's consistent with the above system.
It seems straightforward to represent equation (1) in terms of the input parameters for filter, i.e.,
but then what?
Playing around, I set
y = [ 1.0000 1.1000 1.2100 1.3310 ];
Miraculously, this is the solution to (1) when y(1) = 1; x(t) = 0, for t=1,...3 but I have no idea why. Could somebody explain please?
The other things I need to figure out in order to solve my optimal control problem are How do I incorporate in the difference equation (2) into the program? How do I impose the terminal condition y(4)= 1.21? Apparently How do I solve for the x vector that's consistent with the initial and terminal conditions The correct answer for my example is x = [ 0.0333 , 0.0367 , 0.0403 ] According to the help screen [ Y, Zf ] = filter(b,a,x,Zi) "gives access to initial and final conditions, Zi and Zf, of the delays" which looks promising, but I have no idea how it's suppose to work.
Any help would be most appreciated!