I'm using pgfplots to make a linear regression of some data. I know the curve should pass through zero (Hookes law).
data.csv:
F,delta
2.4525,0.6
4.905,1.05
7.3575,1.5
9.81,2.4
12.2625,2.5
14.715,3.35
17.1675,4
19.62,4.85
24.525,6.35
29.43,7.85
34.335,10.85
39.24,11.85
44.145,15.85
49.05,17.25
53.955,21.25
latexfile:
\documentclass{standalone}
\usepackage{tikz}
\usepackage{pgfplots}
\usepackage{pgfplotstable}
\pagestyle{plain}
\begin{document}
\begin{tikzpicture}
\begin{axis}[
width=\linewidth, % Scale the plot to \linewidth
]
\addplot
table[x=F,y=delta,col sep=comma, only marks] {data.csv};
\addplot [no markers]
table[x=F,y={create col/linear regression={y=delta}}, col sep=comma] {data.csv};
\legend{Metingen,Lineaire regressie: $\delta=\pgfmathprintnumber{\pgfplotstableregressiona} \cdot F$}
\end{axis}
\end{tikzpicture}
\end{document}
How can I force the linear regression to pass through the origin?


gnuplotfor plotting a NACA2412 airfoil in that document, sognuplotisn't any problem :) – rubdos Mar 14 '15 at 18:00