I'm very new to Mathematica (as will make itself clear with this question) and I'm trying to create a program that makes b-splines to fit n points. I'm not quite sure how to reference the i-th point in my list of random reals in order to shift the next spline to begin at the next point. Any help is appreciated.
n = 10;
p1[x_] := 1/6*(-x^3 + 3 x^2 - 3 x + 1);
p2[x_] := 1/6*(3 x^3 - 6 x^2 + 4);
p3[x_] := 1/6*(-3 x^3 + 3 x^2 + 3 x + 1);
p4[x_] := 1/6*(x^3);
points = Table[{RandomReal[{1, 10}], RandomReal[{1, 10}]}, {i, 1, n}];
data = {};
For[j = 0, j <= 7, j++,
spline =
p1[x]*points[[i]] + p2[x]*points[[i + 1]] +
p3[x]*points[[i + 2]] + p4[x]*points[[i + 3]];
AppendTo[data, spline];];
ParametricPlot[data, {x, 0, 1}]
j
's toi
(ori
toj
)? Does that make it work? $\endgroup$