linspacefixeddiff.m 365 B

123456789101112131415
  1. function f = linspacefixeddiff(x,d,n)
  2. % function f = linspacefixeddiff(x,d,n)
  3. %
  4. % <x> is a number
  5. % <d> is difference between successive numbers
  6. % <n> is the number of desired points (positive integer)
  7. %
  8. % return a vector of equally spaced values starting at <x>.
  9. %
  10. % example:
  11. % isequal(linspacefixeddiff(0,2,5),[0 2 4 6 8])
  12. x2 = x+d*(n-1);
  13. f = linspace(x,x2,n);