Given below is a boundary value problem from Ref. 1.
Pseudospectral collocation requires the following steps
- discretize domain, state and control at
$n+1$ points - discrete state and control input are the variables
- approximate state
$(x(t))$ and control$(u(t))$ using global polynomials - differentiate the polynomial to the required degree and evaluate at the collocation points
- evaluate the boundary value problem at the collocation points
- dynamics evaluated at interior points
- boundary conditions at -1 and 1
- depending on the dynamics, system of linear/nonlinear system of equations need to be solved
An optimization problem without an objective function and inequality constraints is simply a system of equation which may be linear or nonlinear.
Using the principle, we use IPOPT to solve the system of nonlinear equations. CasADi's Opti()
(meant as modelling language for optimization problems) is used to model the equations.
The codes serve the following purposes.
bvp_main.m
- solve the BVP for a given grid size and compare with analytical solutionbvp.m, convergence.m
- study exponential/spectral convergence of discretization errorlegslb.m, legslbdiff.m, lepoly.m, lepolym.m
- supplementary files for LGL collocation
- OCTAVE-6.1.0
- CasADi-3.5.5
A key feature of pseudospectral collocation is rapid decrease in discretization error with increasing grid size. However, for larger N (
Some methods to mititgate ill-conditioning include using knotting, preconditioners and Birkhoff collocation.
Footnotes
-
Wang, L. L., Samson, M. D., & Zhao, X. (2014). A well-conditioned collocation method using a pseudospectral integration matrix. SIAM Journal on Scientific Computing, 36(3), A907-A929. ↩