Home > Mobile >  How to draw tangent line to a data point in gnuplot?
How to draw tangent line to a data point in gnuplot?

Time:01-07

I am wondering how to draw a tangent line to a data point from csv data file in gnuplot. Thanks for help

I tried some sort of fitting but it does not work.

CodePudding user response:

How do you specify your data point for the tangent? By x-value? Are there unique y-values for all x-values? You give very little information and no example data, so I assume something.

Get the current and previous x-values into the variables x1 and x0, respectively. If your x-value for the tangent xt is between x0 and x1 calculate the slope m and the y-axis-offset c. Your tangent line then is y = m*x c.

If you want to plot a tangent to a function you could use enter image description here

  • Related