2015-03-31 49 views
1

我一直在努力解决这种情况已经有好几天了,我真的很感激一条建议。我有一个模拟运行在C++和最后我得到一个.csv文件的4列:t,L_1(t),L_2(t),L_3(t)。使用CSV数据在3D空间中着色曲线

我要绘制的功能是L(T)= L_1(t)的 + L_2(t)的Ĵ + L_3(t)的ķ,L(0)=(0,0, 0)。

我想在三维图表中绘制函数L(t)在数据表中走过的路径。另外,我也想把时间的(log)作为一个色阶来表示函数的演化路径。

我尝试了几个选项,但没有真正做到我想要的。你可以帮帮我吗?

谢谢!

回答

0

这是最简单直接的Line图形做:用

data = Table[ { t, Sin[t] , Cos[t] , (t/20)^2 } , {t, 0, 20, .5 }]; 
[email protected][ data[[All, 2 ;; 4]]] 

enter image description here

您可以用颜色这个VertexColors

,你也可以做插值,然后用ParametricPlot3D

interp = Table[ Interpolation[data[[All, i]]] , {i, 2, 4}] 
ParametricPlot3D[[email protected][t], {t, 1, 40}] 

enter image description here

用这个你可以玩InterpolationOrder选项来控制平滑。

在色彩(以及InterpolationOrder->1

ParametricPlot3D[[email protected][t], {t, 1, 40}, 
     ColorFunction -> Function[{x, y, z, t}, Hue[t]]] 

enter image description here