x=1:7;
y=sin(1.5*x);
M=piecewise_cubic(x,y);
I1=1:0.01:2;
s1=polyval(M(1,:),I1);
I2=2:0.01:3;
s2=polyval(M(2,:),I2);
I3=3:0.01:4;
s3=polyval(M(3,:),I3);
I4=4:0.01:5;
s4=polyval(M(4,:),I4);
I5=5:0.01:6;
s5=polyval(M(5,:),I5);
I6=6:0.01:7;
s6=polyval(M(6,:),I6);

plot(I1,s1,I2,s2,I3,s3,I4,s4,I5,s5,I6,s6);
% If you want to compare the interpolant with the real function
% f(x)=sin(1.5*x), comment the previous plot command and un-comment the
% three lines below:
% u=1:0.01:7;
% v=sin(1.5*u);
% plot(I1,s1,I2,s2,I3,s3,I4,s4,I5,s5,I6,s6,u,v);

