Skip to content

Commit 900e900

Browse files
committed
fix readme and update fit example
1 parent 2de1804 commit 900e900

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
@@ -143,15 +143,18 @@ julia> roots(Polynomial([0, 0, 1]))
143143
Fit a polynomial (of order `deg`) to `x` and `y` using a least-squares approximation.
144144

145145
```julia
146-
julia> xs = 1:4; ys = exp(xs);
146+
julia> xs = 0:4; ys = @. exp(-xs) + sin(xs);
147147

148148
julia> fit(xs, ys)
149-
Polynomial(-7.717211620141281 + 17.9146616149694x - 9.77757245502143x^2 + 2.298404288652356x^3)
149+
Polynomial(1.0000000000000016 + 0.059334723072240664*x + 0.39589720602859824*x^2 - 0.2845598112184312*x^3 + 0.03867830809692903*x^4)
150+
151+
julia> fit(ChebyshevT, xs, ys, deg=2)
152+
ChebyshevT([0.541280671210034, -0.8990834124779993, -0.4237852336242923])
150153
```
151154

152155
Visual example:
153156

154-
![newplot 42](https://user-images.githubusercontent.com/3156114/41799777-9ba00582-7627-11e8-94ef-15297ec8790e.png)
157+
![fit example](https://user-images.githubusercontent.com/14099459/70382587-9e055500-1902-11ea-8952-3f03ae08b7dc.png)
155158

156159
#### Other methods
157160

0 commit comments

Comments
 (0)