Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- airfoildata = Drop[Take[
- Drop[
- Import["n64015.dat"], 3], 53], {27}];
- airfoildata = Join[Reverse[Drop[Take[airfoildata, 26], 1]],
- Drop[airfoildata, 26]];
- pts = Take[airfoildata, 20];
- n = Length[pts];
- dist = Accumulate[
- Table[EuclideanDistance[pts[[i]], pts[[i + 1]]], {i, Length[pts] - 1}]];
- param = N[Prepend[dist/Last[dist], 0]];
- deg = 3;
- knots = Join[ConstantArray[0, deg], Range[0, 1, 1/(n - deg)],
- ConstantArray[1, deg]];
- m = Table[BSplineBasis[{deg, knots}, j - 1, param[[i]]], {i, n}, {j, n}];
- ctrlpts = LinearSolve[m, pts];
- ListPlot[airfoildata, Prolog -> BSplineCurve[ctrlpts],
- PlotStyle -> Directive[Red, PointSize[Medium]]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement