Skip to content

Commit f7fe5a4

Browse files
authored
Make it clear that polyfit accepts an order param
1 parent 1308ee6 commit f7fe5a4

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,16 +156,19 @@ julia> roots(Poly([0, 0, 1]))
156156
0.0
157157
```
158158

159-
#### Polyfit
159+
#### polyfit(x, y, n=length(x)-1)
160160

161-
* `polyfit`: fits a polynomial of minimal degree fitting the points
162-
specified by `x` and `y` using the least-squares fit.
161+
* `polyfit`: fits a polynomial (of order `n`) to `x` and `y` using a least-squares approximation.
163162

164163
```julia
165164
julia> xs = 1:4; ys = exp(xs); polyfit(xs, ys)
166165
Poly(-7.717211620141281 + 17.9146616149694x - 9.77757245502143x^2 + 2.298404288652356x^3)
167166
```
168167

168+
Visual example:
169+
170+
![newplot 42](https://user-images.githubusercontent.com/3156114/41799777-9ba00582-7627-11e8-94ef-15297ec8790e.png)
171+
169172
#### Other methods
170173

171174
Polynomial objects also have other methods:

0 commit comments

Comments
 (0)