x=[-2:0.01:2];
n=size(x,2);
y=zeros(n,1);
y1=zeros(n,1);
m=10;
k=floor(n/m);
for i=1:n
  y(i)=sin(x(i)*cos(x(i)))*cos(x(i));
end;
for i=0:k-1
  for j=1:m
    y1(m*i+j)=y(m*i+1);
  end;
end;
for j=m*k+1:n
  y1(j)=y(m*k+1);
end;
%plot(x,y,'k');
plot(x,y1,'k');