## Pseudospectral methods for boundary value problems
Given below is a boundary value problem from Ref. [^1].
$$
\begin{equation}
\ddot{x}-t\dot{x}-x=0
\end{equation}
$$
$$
\begin{aligned}
x(t=-1)&=1\\
x(t=1)&=1
\end{aligned}
$$
$x^*(t)=\exp(\frac{t^2-1}{2})$ is the solution to the boundary value problem.
### Numerical solution
Pseudospectral collocation requires the following steps
1. discretize domain, state and control at $n+1$ points
2. discrete state and control input are the variables
3. approximate state $(x(t))$ and control $(u(t))$ using global polynomials
4. differentiate the polynomial to the required degree and evaluate at the collocation points
5. evaluate the boundary value problem at the collocation points
* dynamics evaluated at interior points
* boundary conditions at -1 and 1
8. depending on the dynamics, system of linear/nonlinear system of equations need to be solved
## Implementation
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 solution
* ```bvp.m, convergence.m``` - study exponential/spectral convergence of discretization error
* ```legslb.m, legslbdiff.m, lepoly.m, lepolym.m``` - supplementary files for LGL collocation
## Requirements
* OCTAVE-6.1.0
* CasADi-3.5.5
## Comparison of numerical and analytical results
### side by side plot
![image](sol.svg)
### error plot
![image](esol.svg)
### Spectral/exponential convergence
A key feature of pseudospectral collocation is rapid decrease in discretization error with increasing grid size. However, for larger N ($\geq 100$),
the problem can get numerically ill-conditioned.
Some methods to mititgate ill-conditioning include using knotting, preconditioners and Birkhoff collocation.
![image](exp.svg)
## References
[^1]: 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.
![avatar](https://profile-avatar.csdnimg.cn/864ffdc5a26342a6add0026479aef1e5_matlab_dingdang.jpg!1)
matlab科研助手
- 粉丝: 3w+
- 资源: 5994
最新资源
- X00333-NeRF神经辐射场源码优化与数据集处理:'cameras-sphere.npz'的数据结构解析及'nerf-model.pth'模型应用详解,X00333-NeRF神经辐射场优化源码与数
- 优化NeRF神经辐射场数据结构:cameras-sphere.npz数据集的相机参数处理与nerf-model.pth模型的实践应用,X00333-NeRF神经辐射场优化策略:cameras-sphe
- 基于TSPC的超低功耗动态逻辑电路的两级PipeSAR ADC设计:从文字解读看深度技术解析与性能优化,基于TSPC的超低功耗动态逻辑电路的两级PipeSAR ADC设计说明书文档分享,12bit 1
- 基于Comsol离子沉积模型的无沉积与有沉积情况对比分析,COMSOL离子沉积模型下的沉积与无沉积情况对比研究,comsol离子沉积模型 有无沉积情况对比 ,COMSOL离子沉积模型; 沉积情况对
- xingchengdan
- TS-180在TIA Portal中的组态.pdf
- 计算机二级WPS真题题库6套.zip
- Python爬虫入门教程.pdf :详解requests库与BeautifulSoup库实现简易爬虫
- 变形金刚烟灰缸-微信公众号:天天自学网).stp
- 大学计算机基础选择题详解(四) Python基础
- C++图书管理系统-经典框架实现
- C语言中的基本输入输出.pdf
- 深入解析:基于F28335的3KW双级微型光伏逆变器拓扑设计全方案,深入解析:基于F28335的3KW双级微型光伏逆变器拓扑设计全方案,手把手教你3KW双级微型光伏逆变器参考电路拓扑设计(114) 基
- 深度解析:利用Carsim Simulink联合仿真与运动学MPC算法实现圆形路径跟踪控制-详细视频教程与代码实例,深入解析:基于运动学MPC算法的圆形路径跟踪控制与carsim simulink联
- 基于STM32F030C8T6内核CORTEX M0的Modbus RTU从站项目测试成功:完整功能码0x03与0x06验证正常,基于STM32F030C8T6内核CORTEX M0的Modbus R
- 503二手交易平台_zip.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback](https://img-home.csdnimg.cn/images/20220527035711.png)
![feedback-tip](https://img-home.csdnimg.cn/images/20220527035111.png)