Matlab differene equation question
I hav a question im not quiet sure how to do on matlab. Here it is:
Consider the following difference equation:
q(n) = 2*q(n-1) + q(n-2) - 2*q(n-3)
The analytical solution of the difference equation will be in the form
q(n) = a(1) + a(2)*(-1)^n + a(3)*2^n
Write down the system of linear equations in a(1), a(2), a(3) so that q(0) = 1
q(1) = 2, q(2) = 2.5. Use Matlab to find the values for a(1), a(2), a(3). Hand in your Matlab commands.
Usually I would do this by coming up with three simultaneous equations and solving them manually (or with a calculator) but this asks specifically for Matlab, and we havnt done simultanious equations, so i'm assuming theres another way, and if not mabe someone could run me through simultanious equations on Matlab.
Any help is greatly appreciated.