Mathematica: How to obtain data points plotted by plot command?

后端 未结 7 1796
[愿得一人]
[愿得一人] 2021-01-30 15:34

When plotting a function using Plot, I would like to obtain the set of data points plotted by the Plot command.

For instance, how can I obtain the list of points {t,f} P

相关标签:
7条回答
  • 2021-01-30 16:04

    One way is to use EvaluationMonitor option with Reap and Sow, for example

    In[4]:= 
    (points = Reap[Plot[Sin[x],{x,0,4Pi},EvaluationMonitor:>Sow[{x,Sin[x]}]]][[2,1]])//Short
    
    Out[4]//Short= {{2.56457*10^-7,2.56457*10^-7},<<699>>,{12.5621,-<<21>>}}
    
    0 讨论(0)
提交回复
热议问题