Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
If your points are not already ordered, FindCurvePath is useful. –  Szabolcs Aug 29 '13 at 14:50
    
Thank you very much for your suggestion. I' ve already done what I wanted and it looks just the way it should. :) –  Luka Aug 29 '13 at 18:32

1 Answer 1

up vote 6 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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