diff options
Diffstat (limited to 'Master/texmf-dist/doc/asymptote/examples/leastsquares.asy')
-rw-r--r-- | Master/texmf-dist/doc/asymptote/examples/leastsquares.asy | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/Master/texmf-dist/doc/asymptote/examples/leastsquares.asy b/Master/texmf-dist/doc/asymptote/examples/leastsquares.asy index 37477d58858..6362e8323ef 100644 --- a/Master/texmf-dist/doc/asymptote/examples/leastsquares.asy +++ b/Master/texmf-dist/doc/asymptote/examples/leastsquares.asy @@ -22,7 +22,7 @@ real last=700; // Remove negative or zero values of rho: t=rho > 0 ? t : null; rho=rho > 0 ? rho : null; - + scale(Log(true),Linear(true)); int n=step > 0 ? ceil((last-first)/step) : 0; @@ -33,17 +33,17 @@ for(int i=0; i <= n; ++i) { real first=first+i*step; real[] logrho=(t >= first & t <= last) ? log(rho) : null; real[] logt=(t >= first & t <= last) ? -log(t) : null; - + if(logt.length < 2) break; - + // Fit to the line logt=L.m*logrho+L.b: linefit L=leastsquares(logt,logrho); - + T.push(first); xi.push(L.m); dxi.push(L.dm); -} - +} + draw(graph(T,xi),blue); errorbars(T,xi,dxi,red); |