How to display the output as the input with a fractional delay? I am trying to introduce a fractional delay in my input vector x[n] so the output is something like y[n]=x[n-M/N]. I am not supposed to use the MATLAB fracdelay function.So, I used sampling and delay. The three steps I followed are:

1)Upsample the input by M.

2)Delay the upsampled version.

3)Downsample the output obtained in step 2 to get y[n].

However I can't get the correct fractionally delayed output. Can someone please help? Here is my MATLAB code:

x=[1 2 3 4 1 3 4 5 6 3];
up=upsample(x,2);

z=zeros(1,10);

for n=1:10; 
   k=n+1;
   z(1,k)=up(1,n);
end

y=downsample(z,2,1);
subplot(411);
stem(x)
subplot(412)
stem(up)
subplot(413);
stem(z)
subplot(414);
stem(y)


Here is how my output looks like:
The problem is that you are using "upsample", which merely inserts zeros in between the original samples, instead of "interp", which upsamples and then low-pass filters.