Skip to content

prisong97/BSplines

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 

Repository files navigation

Experimentation with B-Splines

This code implements and visualises the B-splines basis functions. We implement these functions from scratch.

Dependencies

  • numpy 1.20.1
  • Matplotlib 3.3.4

Useful material

I found the following links helpful:

Visualisation of B-splines basis functions

To compute the B-spline bases, we need to specify:

  1. The degree of the polynomial,
  2. the vector of knot points,
  3. a vector containing the observations (x) for plotting the functions.

The resulting number of basis functions is given by = (# of knot points) - (degree of polynomial + 1)

Example 1: Cubic B-splines functions

spline_degree1 = 3
knots1 = [0,1/4,2/4,3/4,1]
x_list1 = np.linspace(0,0.99999,1000)

plots1 = Bsplines_plots(x_list1, knots1, spline_degree=spline_degree1)

plots1.plot_bases()

Example 1

Example 2: Quadratic B-splines functions

spline_degree2 = 2
knots2 = [0,1,2,3,4,5]
x_list2 = np.linspace(0,4.99999,1000)

plots1 = Bsplines_plots(x_list2, knots2, spline_degree=spline_degree2)

plots2.plot_bases()

Example 1

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published