4
$\begingroup$

I have a list of data and want to make a curve like the one below which I made in solidworks. The problem of this curve is, that I don't know how to put it in a box with coordinates.

The best I could get in Mathematica are points connected with lines, which is not good enough. My code is:

Graphics3D[
  {Red, Line[pot], Black, AbsolutePointSize[6], Point[pot]}, 
  BoxRatios -> {3, 2, 1.5}, Axes -> True, ImageSize -> 450]

And this the image it produces:

enter image description here

Is there a solution?

$\endgroup$
2
  • $\begingroup$ If your points are not already ordered, FindCurvePath is useful. $\endgroup$
    – Szabolcs
    Commented Aug 29, 2013 at 14:50
  • $\begingroup$ Thank you very much for your suggestion. I' ve already done what I wanted and it looks just the way it should. :) $\endgroup$
    – Luka
    Commented Aug 29, 2013 at 18:32

1 Answer 1

7
$\begingroup$

Your (x,y,z) data:

data = Table[{Sin[u], Cos[u], u/10}, {u, 0`, 20, 0.05}];

Your parametric interpolating function:

intf = Interpolation[MapIndexed[{#2, #} &, data]];

Your plot:

ParametricPlot3D[intf[x], {x, 1, Length@data}]

enter image description here

If you don't keep the data you should note that the InterpolatingFunction assigned to intf also includes the range of data. You can view it manually by looking at intf which will show the skeleton form of the expression, or you can extract it with intf[[1, 1]]. Example:

ParametricPlot3D[intf[x], {x, ##}] & @@ intf[[1, 1]]

If your line looks odd you may need to adjust the InterpolationOrder or Method options.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.