MATLAB: Matlab question, very stuck

help

I am very stuck with this question, any help would be appreciated.
function [New_Matrix] = sequence_matrix(n)
%UNTITLED4 Summary of this function goes here
% Detailed explanation goes here
if n ==1
v=2
elseif n==2
v=3
elseif n>=3
i(n) = 2*v(n-1) + 3*v(n-2)
i=zeros(n,n);
m = i;
i(1:n+1:end) = v
end

Best Answer

Close but not quite. Try it this way:
function [New_Matrix] = sequence_matrix(n)
% Detailed explanation goes here
New_Matrix = zeros(n);
v = 2;
if n >= 2
v = [2, 3];
end
if n >= 3
for k = 3 : n
v(k) = 2*v(k-1) + 3*v(k-2)
end
end
for k = 1 : n
New_Matrix(k, k) = v(k);
end
end