In [1]:
using BasisMatrices
using Plots
In [2]:
plotlyjs()
Out[2]:
In [3]:
n = 10
a, b = 0, 1
basis1 = Basis(ChebParams(n, a, b))
Out[3]:
In [4]:
xgrid = collect(linspace(a, b, 101))
ys = []
m = 9
for i in 1:m
c = zeros(n)
c[i] = 1
y = funeval(c, basis1, xgrid)
push!(ys, y)
end
ylims = (-1.1, 1.1)
plot(xgrid, ys, layout=m, ylims=ylims, leg=false)
Out[4]:
In [5]:
n = 10
a, b = 0, 1
basis2 = Basis(LinParams(n, a, b))
Out[5]:
In [6]:
xgrid = collect(linspace(a, b, 101))
ys = []
m = 9
for i in 1:m
c = zeros(n)
c[i] = 1
y = funeval(c, basis2, xgrid)
push!(ys, y)
end
ylims = (-1.1, 1.1)
plot(xgrid, ys, layout=m, ylims=ylims, leg=false)
Out[6]:
In [7]:
breaks = [a, b]
evennum = 7
k = 3
basis3 = Basis(SplineParams(breaks, evennum, k))
Out[7]:
In [12]:
xgrid = collect(linspace(a, b, 101))
ys = []
m = 9
for i in 1:m
c = zeros(basis3.n[1], basis3.n[1])
c[i, i] = 1
y = funeval(c, basis3, xgrid)
push!(ys, y[:, i])
end
ylims = (-1.1, 1.1)
plot(xgrid, ys, layout=m, ylims=ylims, leg=false)
Out[12]:
In [ ]: