Creating L points with uniform spacing d?
Show older comments
Hi everyone,
I want to create a vector of L points along the x-axis which have a uniform spacing d. I have done as follows:
L=32;
d = 0.063
px = linspace(-d*L/2,d*L/2,L)';
but when I check the distance among them it result 0.065, why this? Suggestion? Thank you!
EDIT: I've read the documentation and according to it the spacing is (x2-x1)/(n-1), so to obtain a correct spacing I should have 33 points instead of 32, including the zero among the points, but the fact is that I don't want the 0 in my vector, so I think that the problem should be the definition of x1 and x2..how can I resolve?
1 Comment
Ive J
on 13 Dec 2020
Why don't you use colon then?
px = x1:0.065:x2; % no guarantee that x2 will be within px though
Accepted Answer
More Answers (1)
Categories
Find more on Creating and Concatenating Matrices in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!