You shouldn't need to write a function for this. I would just define your first x and y, and then n being the length:
x1=1; y1=4; n=20; %nominally selected values
Your answer would then be:
x=x1.*ones(1,n);
y=y1:y1+n-1;
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!