You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Interpolation is most efficient and accurate if we evaluate our function at the points given by `chebpoints`. However, we can also perform least-square polynomial fitting (in the Chebyshev basis, which is well behaved even at high degree) from an *arbitrary* set of points — this is useful if the points were specified externally, or if we want to "smooth" the data by fitting to a polynomial of lower degree than for interpolation. For example, we can fit the same function above, again to a degree-200 Chebyshev polynomial, using 10000 *random* points in the domain:
72
+
Interpolation is most efficient and accurate if we evaluate our function at the points given by `chebpoints`. However, we can also perform least-square polynomial fitting (in the Chebyshev basis, which is well behaved even at high degree if there are sufficiently many data points) from an *arbitrary* set of points — this is useful if the points were specified externally, or if we want to "smooth" the data by fitting to a polynomial of lower degree than for interpolation. For example, we can fit the same function above, again to a degree-200 Chebyshev polynomial, using 10000 *random* points in the domain:
68
73
```jl
69
74
xr =rand(10000) *10# 10000 uniform random points in [0, 10]
70
-
c=chebregression(xr, f.(xr), 0, 10, 200) # fit to a degree-200 polynomial
75
+
cr=chebregression(xr, f.(xr), 0, 10, 200) # fit to a degree-200 polynomial
0 commit comments