MATLAB: Graph for a set of equations not giving correct results

difference equationdifferential equationselectrical engineeringengineeringequationsforfor loopgraphiterationmathematicsplotsubplot

Respected members: I wanted to plot graph of 'v' on y-axis versus 'n' on x-axis for the following set of equations for k=0.07.I wanted to do 30 iterations of these equations to get the required graph,so,I took n from 1:30 in the code.
The conditions for H are
H(d(n))=0 if d(n)<0
H(d(n))=1 if d(n)>1
(=> H(d(n)^2)=1)
H(d(n))=d(n) otherwise
(=>if H(d(n))=d(n) => H(d(n)^2)=d(n)^2)
The correct graph which I should get is
However,because of some error in my code,I could not get this graph.
% Code-(Edited after discussion)
k=0.07
v=zeros(31,1);
v(1)=45;
for n=1:30
d(n)=0.2874-(k*(v(n)-25));
if d(n)<0
v(n+1)=(0.8872*v(n))
else if d(n)>1
v(n+1)=(0.8872*v(n))+((1.2*256)/(v(n)-16))
else
v(n+1)=(0.8872*v(n))+((1.2*256*d(n)^2)/(v(n)-16))
end
end
end
plot(1:31,v)
The page 3 of the following research paper is relevant. http://ieeexplore.ieee.org/abstract/document/7231874/

Best Answer

k=0.07;
v=zeros(31,1);
v(1)=45;
for n=1:30
d=0.2847-0.07*(v(n)-25);
v(n+1)=0.2847*v(n)+1.2*256*d^2/(v(n)-16);
end
v
Do you get an ouput for v ?
Best wishes
Torsten.