Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/prisong97/BSplines
Browse files Browse the repository at this point in the history
  • Loading branch information
prisong97 committed Nov 27, 2021
2 parents 0f230c8 + 14bc235 commit 1436ff6
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
## Experimentation with B-Splines

This code implements and visualises the B-splines basis functions. We implement these functions from scratch. This is a good exercise to check that I am understanding what's going on under the hood.
This code implements and visualises the B-splines basis functions. We implement these functions from scratch.

### Dependencies
- numpy 1.20.1
Expand All @@ -21,13 +21,25 @@ The resulting number of basis functions is given by = (# of knot points) - (degr

#### Example 1: Cubic B-splines functions
```
spline_degree = 3
knots = [0,1/4,2/4,3/4,1]
x_list = np.linspace(0,0.99999,1000)
spline_degree1 = 3
knots1 = [0,1/4,2/4,3/4,1]
x_list1 = np.linspace(0,0.99999,1000)
plots = Bspline_plots(x_list, knots, spline_degree=spline_degree)
plots1 = Bsplines_plots(x_list1, knots1, spline_degree=spline_degree1)
plots.plot_bases()
plots1.plot_bases()
```
![Example 1](Bsplines/plots/example1-degree-3.png)

#### Example 2: Quadratic B-splines functions
```
spline_degree2 = 2
knots1 = [0,1,2,3,4,5]
x_list1 = np.linspace(0,4.99999,1000)
plots1 = Bsplines_plots(x_list2, knots2, spline_degree=spline_degree2)
plots2.plot_bases()
```
![Example 1](Bsplines/plots/example2-degree-2.png)

0 comments on commit 1436ff6

Please sign in to comment.