function f = linspacefixeddiff(x,d,n) <x> is a number <d> is difference between successive numbers <n> is the number of desired points (positive integer) return a vector of equally spaced values starting at <x>. example: isequal(linspacefixeddiff(0,2,5),[0 2 4 6 8])
0001 function f = linspacefixeddiff(x,d,n) 0002 0003 % function f = linspacefixeddiff(x,d,n) 0004 % 0005 % <x> is a number 0006 % <d> is difference between successive numbers 0007 % <n> is the number of desired points (positive integer) 0008 % 0009 % return a vector of equally spaced values starting at <x>. 0010 % 0011 % example: 0012 % isequal(linspacefixeddiff(0,2,5),[0 2 4 6 8]) 0013 0014 x2 = x+d*(n-1); 0015 f = linspace(x,x2,n);