% Sequence.m
% Script for EGR 390 HW1 problem 1
% Program to find y[k] in the sequence 1 2 5 12 29 70 169
%
% J Cardell, Feb 2009

% Second order difference equation - must define two initial conditions
y(1) = 1;
y(2) = 2;

% Determine 150th value in the given geometric sequence, that is
% represented by the difference equation below
for k = 3 : 150
    y(k) = 2*y(k-1) + 1*y(k-2);
end
    
% Print final value to screen
disp ('y[150] = ')
y(150)
