Now Loading ...
-
-
最优控制基础 - 课程笔记
最优控制基础 - 课程笔记
0. 5月-6月航天大事件
批量列出
1971年
5月14日: 中国第二颗卫星、第一颗科学实验卫星“实践一号”停止发射信号,结束其工作寿命。该卫星于3月3日发射,设计寿命20天,实际工作28天。这次早期任务对于积累卫星研制和空间科学实验的基础经验至关重要。
1980年
5月18日: 首次成功向太平洋预定海域发射“东风五号”洲际弹道导弹。虽然属于军事领域,但该事件凸显了导弹技术对运载火箭发展的奠基性作用,许多早期运载火箭技术源于弹道导弹。
1997年
5月12日: “长征三号甲”运载火箭成功发射新一代通信广播卫星“东方红三号”。卫星于5月20日成功定点。这表明中国在国产通信卫星技术上持续进步,以满足国内日益增长的信息化需求。
2002年
5月15日: “长征四号乙”运载火箭成功将“风云一号D”气象卫星和中国首颗海洋水色卫星“海洋一号”送入预定轨道。此次发射结束了中国没有自主海洋观测卫星的历史,显示了中国空间应用领域向气象、海洋等多元化方向拓展。
2003年
5月24日: “长征二号丙”运载火箭发射“实践十九号”卫星。作为“实践”系列的一部分,此类任务通常用于新技术验证和空间科学实验,为未来操作系统的发展进行在轨测试。
2007年
5月14日: “长征三号乙”运载火箭成功发射尼日利亚通信卫星一号(Nigcomsat-1),并实现在轨交付。这是中国首次实现整星出口和首次以火箭、卫星及发射支持一体化的方式提供国际商业发射服务,标志着中国在国际航天市场上的能力提升。
5月25日: “长征三号甲”运载火箭发射一颗“北斗”导航卫星(北斗一号03星)。这显示了北斗导航系统作为国家战略基础设施的持续建设。
2008年
5月27日: “长征三号乙”运载火箭发射“中星九号”广播电视直播卫星。部署此类专用广播卫星有助于扩大国内广播电视服务的覆盖范围。
2010年
6月2日: “长征三号丙”运载火箭发射“北斗二号”系统第三颗地球同步轨道卫星(北斗-2 G3)。这标志着北斗二号区域导航系统的稳步部署。
6月9日: “嫦娥二号”月球探测器完成其主要月球探测任务后,开始执行拓展任务。这展示了中国航天器超越设计目标的任务灵活性和长寿命运行能力,并为后续的深空探测任务(如飞越小行星)积累了经验。
2012年
5月10日: “长征三号乙”运载火箭发射“北斗二号”系统第六颗地球同步轨道卫星(北斗-2 G6)。进一步完善北斗二号区域系统星座,为2012年底宣布提供区域服务奠定基础。
6月16日: “长征二号F”运载火箭成功发射“神舟九号”载人飞船,航天员为景海鹏、刘旺和中国首位女航天员刘洋。
6月18日: “神舟九号”与“天宫一号”目标飞行器成功实现自动交会对接,航天员进入“天宫一号”。
6月24日: 航天员刘旺成功进行首次手控交会对接。这次任务是中国载人航天工程“第二步”战略的关键一步,全面掌握了载人天地往返、自动及手动空间交会对接技术,并实现了女性航天员的太空飞行。
2013年
6月11日: “长征二号F”运载火箭发射“神舟十号”载人飞船,航天员为聂海胜、张晓光、王亚平。
6月13日: “神舟十号”与“天宫一号”完成自动交会对接。
6月20日: 航天员王亚平在“天宫一号”内进行了中国首次太空授课。
6月26日: “神舟十号”载人飞船返回舱安全着陆。此次任务是“天宫一号”的最后一次载人访问,巩固了交会对接技术,验证了航天员中期驻留保障能力,并开展了科普教育活动,标志着载人航天工程“第二步”第一阶段任务(空间实验室阶段)的圆满收官。
2016年
6月25日: 新一代中型运载火箭“长征七号”在新建成的海南文昌航天发射场成功首飞,搭载了多用途飞船缩比返回舱等载荷。长征七号采用更环保的液氧煤油推进剂,其成功首飞和文昌发射场的启用,为后续空间站货物运输任务(发射天舟货运飞船)奠定了基础,显著提升了中国的近地轨道运载能力。
2017年
6月15日: “长征四号乙”运载火箭成功发射中国首颗X射线空间天文卫星“慧眼”(HXMT)。这标志着中国在空间科学探测领域,特别是在高能天体物理观测方面迈出了重要一步。
2018年
5月21日: “长征四号丙”运载火箭成功发射“嫦娥四号”任务的中继通信卫星“鹊桥号”。作为世界首颗运行在地月L2点晕轨道的通信卫星,“鹊桥号”的成功发射和部署,是实现人类探测器首次在月球背面软着陆和巡视探测的关键前提。
6月2日: “长征二号丁”运载火箭成功发射“高分六号”卫星。作为国家高分辨率对地观测系统重大专项的一部分,“高分六号”的发射进一步增强了中国对地观测能力,服务于农业、林业、资源环境监测等领域。
2019年
6月5日: “长征十一号”固体运载火箭在中国黄海海域成功实施首次海上发射,将“捕风一号”A/B星等7颗卫星送入预定轨道。海上发射平台的应用,验证了中国具备在不同地点灵活发射、满足不同轨道需求的能力,特别是对于快速响应发射和小卫星部署具有重要意义。
2020年
5月5日: 新一代重型运载火箭“长征五号B”在文昌航天发射场成功首飞,搭载发射了新一代载人飞船试验船。长征五号B是为发射空间站大型舱段而研制的,其首飞成功,以及新一代载人飞船试验船的成功试验,直接开启了中国空间站建造阶段的任务序幕,是中国载人航天工程“第三步”战略的关键里程碑。
6月23日: “长征三号乙”运载火箭成功发射北斗三号全球卫星导航系统最后一颗组网卫星(北斗三号GEO-3)。这标志着北斗三号全球系统星座部署全面完成,中国自主建设、独立运行的全球卫星导航系统正式建成开通,对国家安全、经济社会发展具有重大战略意义。
2021年
5月29日: “长征七号”运载火箭成功发射“天舟二号”货运飞船。
5月30日: “天舟二号”与空间站“天和”核心舱完成自主快速交会对接。这是空间站阶段的首次货物运输应用性飞行,验证了空间站货物补给、推进剂在轨补加等关键技术,为后续载人飞行和空间站长期运行奠定了物资基础。
6月17日: “长征二号F”运载火箭成功发射“神舟十二号”载人飞船,航天员为聂海胜、刘伯明、汤洪波。
6月17日: “神舟十二号”与“天和”核心舱完成自主快速交会对接,三名航天员顺利进驻“天和”核心舱,中国人首次进入自己的空间站。作为空间站关键技术验证和建造阶段的首次载人飞行任务,开启了中国空间站有人长期驻留的时代。
2022年
5月10日: “长征七号”运载火箭成功发射“天舟四号”货运飞船,并与空间站组合体完成自主快速交会对接 10。此次任务为即将到来的神舟十四号乘组运送了必要物资,保障了空间站运营的连续性。
6月5日: “长征二号F”运载火箭成功发射“神舟十四号”载人飞船,航天员为陈冬、刘洋、蔡旭哲。飞船与空间站组合体完成自主快速交会对接。神舟十四号乘组在轨期间将经历空间站“问天”、“梦天”两个实验舱的发射对接,完成空间站“T”字基本构型的组装建造,任务极为关键。
2023年
5月10日: “长征七号”运载火箭成功发射“天舟六号”货运飞船。
5月11日: “天舟六号”与空间站组合体完成自主快速交会对接。作为空间站进入应用与发展阶段后的首次货运补给任务,“天舟六号”采用了改进型货船,运载能力得到提升,标志着空间站常态化运营和保障能力的增强。
5月30日: “长征二号F”运载火箭成功发射“神舟十六号”载人飞船,航天员为景海鹏、朱杨柱、桂海潮 。飞船与空间站组合体完成自主快速交会对接。此次任务首次包含“航天驾驶员、航天飞行工程师、载荷专家”三种类型的航天员,特别是载荷专家(桂海潮)的加入,表明空间站开始全面转向大规模空间科学实验和应用阶段。景海鹏成为首位四度飞天的中国航天员。
2024年
5月3日: “长征五号”运载火箭在文昌航天发射场成功发射“嫦娥六号”月球探测器。开启了世界首次月球背面采样返回之旅。
5月8日: “嫦娥六号”探测器成功实施近月制动,顺利进入环月轨道。
5月30日: “长征三号乙”运载火箭成功发射巴基斯坦多任务通信卫星(PakSat-MM1)。再次体现了中国在国际商业发射服务和空间合作领域的持续投入。
6月2日: “嫦娥六号”着陆器和上升器组合体成功着陆在月球背面南极-艾特肯盆地预选着陆区。这是人类探测器首次在月球背面实施的着陆和采样任务,是探月工程的重大突破。
6月4日: “嫦娥六号”上升器携带月球样品自月球背面起飞,进入预定环月轨道。
6月6日: “嫦娥六号”上升器成功与轨道器和返回器组合体完成月球轨道的交会对接,并将月球样品容器安全转移至返回器中。
6月22日: “长征二号丙”运载火箭成功发射中法联合研制的天文卫星(SVOM)。这是中法在空间科学领域的重要合作项目,旨在通过多波段协同观测研究伽马射线暴等高能天体物理现象。
6月25日: “嫦娥六号”返回器携带月球背面样品,准确着陆在内蒙古四子王旗预定区域,任务取得圆满成功。此次任务实现了世界首次月球背面采样返回,获取了独特的月球样品,对研究月球的形成和演化具有极其重要的科学价值。
6月29日: “长征七号甲”运载火箭成功发射“中星3A”卫星。长征七号甲是为满足高轨道发射需求而研制的新一代火箭,此次发射进一步验证了其性能,有助于提升中国在高轨卫星部署方面的能力。
上课提及
2025.4.24:第10个中国航天日,东方红1号55周年,神舟20号神舟19号,第六次会师;
2021.4.29:天和发射;2025.4.29:神舟19号返回;
2024.5.3:嫦娥6号发射;2024.6.25:月背土壤取样返回;
2020.7.23:天问1号发射;2021.5.15:天问1号登火;2021.5.22:祝融号巡视;
2025.5.29:天问2号发射;
2020.5.8:新一代载人飞船试验船返回(5.5发射);
2021.5.29:天舟2号发射;
1. 变分法与最优化问题
1.变分法(最优控制本质)
2.最优化问题
分类:单变量、多变量,有约束、无约束,线性、非线性;
静态优化(参数优化):求函数极值
动态优化(泛函优化):求泛函极值
求解方法:黄金分割法、最优梯度法、Newton法、Lagrange乘子法、罚函数法;
无约束:经典变分法;
约束:极小值原理、动态规划法、线性二次型最优控制;
3.最优控制问题
性能指标:$J=h[x(t_f),t_f]+\int_{ {t_0} }^{ {t_f} } {g\left[ {x(t),u(t),t} \right]dt} $;
求解方法:庞特里亚金最小值原理PMP,贝尔曼动态规划DP;
$J = \phi \left[ {x({t_0}),{t_0},x({t_f}),{t_f} } \right] + \int_{ {t_0} }^{ {t_f} } {L\left[ {x(t),u(t),t} \right]dt} $;
动态约束:$\dot x(t)=f[x(t),u(t),t]$;
路径约束:$b[x(t),u(t),t]\le 0$
边界条件:$\phi[x(t_0),t_0,x(t_f),t_f]=0$
特殊情况:线性二次型最优控制LQ:$J = \frac{1}{2}{x^T}({t_f}){S_f}x({t_f}) + \frac{1}{2}\int_{ {t_0} }^{ {t_f} } {\left[ { {x^T}(t)Q(t)x(t) + {u^T}(t)R(t)u(t)} \right]} dt$
线性时变系统线性一阶动态约束:$\dot x=A(t)x(t)+B(t)u(t)$(初值:$x(t_0)=x_0$);
4.泛函:“函数的函数”;$y=J[x(t)]$;
增量:$\Delta J=J(x+\delta x)-J(x)=\delta J(x,\Delta x)+H\Delta T$,$\delta J(x,\Delta x)+g(x,\Delta x)\left| {\delta x} \right|$;
变分:$\delta J = {\left. {\frac{\partial }{ {\partial \alpha } }J\left[ {x(t) + \alpha \delta x(t)} \right]} \right
{\alpha = 0} },0 \le \alpha \le 1$;$x^*$是极值曲线则$\delta J[x^*,\delta x]=0$,只有当$\delta J[x^*,\delta x]=0$且$\delta^2 J[x^*,\delta x]>0$,$\beta(t_0)=\beta(t_1)=0$,$\int{ {t_0} }^{ {t_1} } { {\alpha ^T}(t)\beta (t)dt = 0} $,则$\alpha(t)\equiv 0,\forall t \in \left[ { {t_0},{t_1} } \right]$;
5.泛函取极值的必要条件:
考虑泛函$J(x) = \int_{ {t_0} }^{ {t_f} } {L(x,\dot x,t)dt} $,${\bf{x} } \in { {\bf{R} }^n}$,边界条件$x({t_0}) = {x_0},x({t_f}) = {x_f}$,$x^*$为极值的必要条件;$\delta J = \int_{ {t_0} }^{ {t_f} } {\left( {\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } } \right)} \delta xdt = 0 \Rightarrow \frac{ {\partial L} }{ {\partial x} } = \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} }$;
端点固定下的泛函极值:$ {\operatorname*{\min} }\limits_{x(t)} J(x) = \int_{ {t_0} }^{ {t_f} } {L(x,\dot x,t)dt} ,\ \ {\rm{s} }{\rm{.t} }{\rm{.} } \ x({t_0}) = {x_0},x({t_f}) = {t_f}$;
必要条件:$\boxed{\delta J = \int_{ {t_0} }^{ {t_f} } {\left( {\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } } \right)} \delta xdt}$ $\Rightarrow $$\boxed{\left{ \begin{array}{l}\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } = 0\x({t_0}) = {x_0},x({t_f}) = {t_f}\end{array} \right.}$;
$\boxed{\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } = 0}$即为欧拉方程;
端点自由下的泛函极值:$ {\operatorname*{\min} }\limits_{x(t)} J(x) = \int_{ {t_0} }^{ {t_f} } {L(x,\dot x,t)dt} , \ \ {\rm{s} }{\rm{.t} }{\rm{.} } \ x({t_0}) = {x_0}$,$t_f$,$x(t_f)$自由;
欧拉方程:$\boxed{\frac{ {\partial L} }{ {\partial x^} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x^} } = 0,{\left. {\frac{ {\partial L} }{ {\partial {x^*} } } } \right
_{ {t_f} } } = 0,{\left. L \right
_{ {t_f} } } = 0}$;
$\boxed{\delta J = \int_{ {t_0} }^{ {t_f} } {\left( {\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } } \right)} \delta xdt + {\left. {\frac{ {\partial L} }{ {\partial \dot x} } } \right
_{ {t_f} } }\delta {t_f} + {\left. {\left[ {L - \frac{ {\partial L} }{ {\partial \dot x} }\dot x} \right]} \right
_{ {t_f} } }\delta {t_f} }$;
必要条件推导:
情形1:$t_f$固定,$x(t_f)$自由:$\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } = 0,{\left. {\frac{ {\partial L} }{ {\partial \dot x} } } \right
_{ {t_f} } } = 0$;
情形2:$t_f$自由,$x(t_f)$固定:$\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } = 0,{\left. {\left[ {L - \frac{ {\partial L} }{ {\partial \dot x} }\dot x} \right]} \right
_{ {t_f} } }\delta {t_f} = 0$;
情形3:$t_f$,$x(t_f)$自由,$t_f$,$x(t_f)$不相关:$\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } = 0,{\left. {\frac{ {\partial L} }{ {\partial {x} } } } \right
_{ {t_f} } } = 0,{\left. L \right
_{ {t_f} } } = 0$;
情形4:$t_f$,$x(t_f)$自由,$t_f$与$x(t_f)$相关,满足$x(t_f)=\theta(t_f)$:$\delta {x_f} = {\left. {\dot x} \right
_{ {t_f} } }\delta {t_f} = {\left. {\dot \theta } \right
{ {t_f} } }\delta {t_f}$,$\delta J = \int{ {t_0} }^{ {t_f} } {\left( {\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } } \right)} \delta xdt + {\left. {\left[ {L - \frac{ {\partial L} }{ {\partial \dot x} }(\dot \theta- \dot x)} \right]} \right
_{ {t_f} } }\delta {t_f}=0$,必要条件欧拉方程为$\boxed{L + \left. {\frac{ {\partial L} }{ {\partial \dot x} }(\dot \theta - \dot x)} \right
= 0}$;
有约束的泛函极值:$ {\operatorname{\min} }\limits_{ {x^}(t)} J(x) = \int_{ {t_0} }^{ {t_f} } {g(x,\dot x,t)dt} ,\ \ {\rm{s} }{\rm{.t} }{\rm{.} } \ f(x,\dot x,t) = 0$;由Lagrange乘子法得到无约束泛函极值:$ {\operatorname{\min} }\limits_{ {x^}(t)} {J_a} = \int_{ {t_0} }^{ {t_f} } {Ldt} ,L = g(x,\dot x,t) + f(x,\dot x,t)$,其必要条件为:$\frac{ {\partial L} }{ {\partial x} } - \frac{d}{ {dt} }\frac{ {\partial L} }{ {\partial \dot x} } = 0,f(x,\dot x,t) = 0$;
端点情况
边界条件($L({x^},{ {\dot x}^},t)$)
备注
1. $ t_f, x(t_f) $ 均固定
$ x^(t_0)=x_0, \, x^(t_f)=x_f $
$2n$ 个方程确定 $2n$ 个积分常数
2. $ t_f $ 固定,$ x(t_f) $ 自由
$ x^*(t_0)=x_0, \, \left. \frac{\partial L}{\partial \dot x} \right
_{t_f} = 0 $
$2n$ 个方程确定 $2n$ 个积分常数
3. $ t_f $ 自由,$ x(t_f) $ 固定
$ x^(t_0)=x_0, \, x^(t_f)=\theta(t_f) $$ \left. L \right
_{t_f} - \left[ \left. \frac{\partial L}{\partial \dot x} \right
_{t_f} \right]^T \dot x^*(t_f) = 0 $
$(2n+1)$ 个方程求解 $2n$ 常数和 $t_f$
4. $ t_f, x(t_f) $ 均自由且独立
$ x^*(t_0)=x_0 $$ \left. L \right
_{t_f} = 0, \, \left. \frac{\partial L}{\partial \dot x} \right
_{t_f} = 0 $
$(2n+1)$ 个方程求解 $2n$ 常数和 $t_f$
5. $ t_f, x(t_f) $ 自由但满足 $ x(t_f) = \theta(t_f) $
$ x^(t_0)=x_0, \, x^(t_f)=\theta(t_f) $$ \left. L \right
_{t_f} + \left[ \left. \frac{\partial L}{\partial \dot x} \right
_{t_f} \right]^T \left( \frac{d\theta}{dt}(t_f) - \dot x^*(t_f) \right) = 0 $
$(2n+1)$ 个方程求解 $2n$ 常数和 $t_f$
\begin{table}[H]
\caption{\textbf{不同情形下泛函极值边界条件的确定} } % Title of the table
\label{Tab.boundary}
\centering % Center the table
\begin{tabular}{ccc} % 3 columns, all centered
\toprule % Top horizontal line
端点情况 & 边界条件 & 备注 \\
\midrule % Middle horizontal line
1. $ t_f, x(t_f) $ 均固定 & $ x^*(t_0)=x_0, \, x^*(t_f)=x_f $ & $ 2n $ 个方程用于确定 $ 2n $ 个积分常数 \\
2. $ t_f $ 固定,$ x(t_f) $ 自由 & $x^*(t_0)=x_0, \,{\left. {\frac{ {\partial L({x^*},{ {\dot x}^*},t)} }{ {\partial \dot x} } } \right|_{ {t_f} } } = 0$ & $ 2n $ 个方程用于确定 $ 2n $ 个积分常数 \\
3. $ t_f $ 自由,$ x(t_f) $ 固定 & $ x^*(t_0)=x_0, \, x^*(t_f)=\theta(t_f) $ ,${\left. {L({x^*},{ {\dot x}^*},t)} \right|_{ {t_f} } } - {\left[ { { {\left. {\frac{ {\partial L({x^*},{ {\dot x}^*},t)} }{ {\partial \dot x} } } \right|}_{ {t_f} } } } \right]^T}{ {\dot x}^*}({t_f}) = 0$ & $(2n+1) $ 个方程用于求解 $ 2n $ 个积分常数和 $ t_f $ \\
4. $ t_f, x(t_f) $ 均自由且独立 & $ x^*(t_0)=x_0$,${\left. {L({x^*},{ {\dot x}^*},t)} \right|_{ {t_f} } }=0,\ {\left. {\frac{ {\partial L({x^*},{ {\dot x}^*},t)} }{ {\partial \dot x} } } \right|_{ {t_f} } } = 0$ & $ (2n+1) $ 个方程用于求解 $ 2n $ 个积分常数和 $ t_f $ \\
5. $ t_f, x(t_f) $ 均自由但满足 $ x(t_f) = \theta(t_f) $ & $ x^*(t_0)=x_0, \, x^*(t_f)=\theta(t_f) $,$ \left.L(x^*, \dot{x}^*, t)\right|_{t_f} + \left[\left.\frac{\partial L(x^*, \dot{x}^*, t)}{\partial \dot{x} }\right|_{t_f}\right]^T \left[\frac{d\theta}{dt}(t_f) - \dot{x}^*(t_f)\right] = 0 $ & $ (2n+1) $ 个方程用于求解 $ 2n $ 个积分常数和 $ t_f $ \\
\bottomrule % Bottom horizontal line
\end{tabular}
\end{table}
6.变分法最优控制问题
可行的$u^*$,$\dot x=f(x,u,t),x\in R^n,u\in R^m,x(t_0)=x_0$,$\psi[x(t_f),t_f]=0$;
最小化目标值$J=\phi[x(t_f),t_f]+\int_{ {t_0} }^{ {t_f} } {L\left[ {x,u,t} \right]dt} $,$\left{ \begin{array}{l}{t_f}:确定/自由 \x({t_f}):确定/自由/由\Psi [x({t_f}),{t_f}] = 0约束\end{array} \right.$;
(对照5.中有约束的泛函极值)有约束的最优控制问题:$ {\operatorname{\min} }\limits_{ {u^}(t)} J(x) = \phi[x(t_f),t_f]+\int_{ {t_0} }^{ {t_f} } {L(x,u,t)dt} ,\ \ {\rm{s} }{\rm{.t} }{\rm{.} } \ f(x,u,t)-\dot x = 0,\ x(t_0)=0,\ \psi[x(t_f),t_f]=0$,$x({t_f})$确定/自由/由$\psi [x({t_f}),{t_f}] = 0$约束;
求解:转化为无约束最优控制问题,实质为有两类约束的泛函极值:$min J_a=\phi+\int_{ {t_0} }^{ {t_f} } {Ldt}+\lambda(f-\dot x)+\gamma \psi$,得到无约束最优控制问题: ${\operatorname{\min} }\limits_{ {u^}(t)} J_a = \phi+\gamma \psi+\int_{ {t_0} }^{ {t_f} } {[L+\lambda(f-\dot x)]dt}$;
古典变分法求解:$t_f$固定情形,$\phi \rightarrow \phi[x(t_f)]$,$\psi \rightarrow \psi[x(t_f)]$,$J_a=\phi+\gamma \psi+ \int_{ {t_0} }^{ {t_f} } {(L+\lambda f- \lambda \dot x)dt}$,令$L+\lambda f=H(x,u,\lambda t)$,${J_a} = \phi + \gamma \psi + \int_{ {t_0} }^{ {t_f} } {(H - \lambda \dot x)dt} = \phi + \gamma \psi - \left. {\lambda x} \right
{ {t_0} }^{ {t_f} } + \int{ {t_0} }^{ {t_f} } {(H + \lambda \dot x)dt} $;
$\star$:$\delta {J_a} = \frac{ {\partial \phi } }{ {\partial x({t_f})} }\delta x({t_f}) + \gamma \frac{ {\partial \psi } }{ {\partial x({t_f})} }\delta x({t_f}) - {\left. \lambda \right
{ {t_f} } }\delta x({t_f}) + \int{ {t_0} }^{ {t_f} } {\left( {\frac{ {\partial H} }{ {\partial x} }\delta x + \frac{ {\partial G} }{ {\partial u} }\delta u + \dot \lambda \delta x} \right)dt}=$$\boxed{\left[ {\frac{ {\partial \phi } }{ {\partial x({t_f})} } + \gamma \frac{ {\partial \psi } }{ {\partial x({t_f})} } - \lambda ({t_f})} \right]\delta x({t_f}) + \left( {\frac{ {\partial \phi } }{ {\partial {t_f} } } + \gamma \frac{ {\partial \psi } }{ {\partial {t_f} } } + { {\left. H \right
}{ {t_f} } } } \right)\delta {t_f} + \int{ {t_0} }^{ {t_f} } {\left[ {\left( {\frac{ {\partial H} }{ {\partial x} } + \dot \lambda } \right)\delta x + \frac{ {\partial H} }{ {\partial u} }\delta u} \right]dt} }$ $= 0$,其中$\boxed{\left( {\frac{ {\partial \phi } }{ {\partial {t_f} } } + \gamma \frac{ {\partial \psi } }{ {\partial {t_f} } } + { {\left. H \right
}_{ {t_f} } } } \right)\delta {t_f} }$项仅当$t_f$为自由情形下;
必要条件:$\frac{ {\partial H} }{ {\partial x} } + \dot \lambda = 0,\frac{ {\partial H} }{ {\partial u} }$,哈密顿函数:$\boxed{H(x,u,\lambda,t)=L+\lambda^Tf}$,①正则方程:$\left{ \begin{array}{l}协状态方程:\boxed{\dot \lambda = - \frac{ {\partial H} }{ {\partial x} } }\状态方程:\boxed{\dot x = f = \frac{ {\partial H} }{ {\partial \lambda } } }\end{array} \right.$,②边界条件(和谐条件):$x(t_0)=x_0,\psi [x(t_f)]=0,\boxed{\lambda ({t_f}) = \frac{ {\partial \phi } }{ {\partial x({t_f})} } + \gamma \frac{ {\partial \psi } }{ {\partial x({t_f})} } }$,③控制方程(极值条件):$\boxed{\frac{ {\partial H} }{ {\partial u} }=0}$;
3.庞特里亚金极小值原理 PMP
1.问题描述:确定一个可行域中的分段-连续最优控制$u^* \in \Omega$,;
2.$H(x^,u^,\lambda^,t)\le H(x^,u,\lambda^*,t)$;
3.定理3.1:$ {\operatorname*{\min} }\limits_{u(t)\in \Omega} J(x) =\phi[x(t_f),t_f]+ \int_{ {t_0} }^{ {t_f} } {L(x,u,t)dt} ,\ \ {\rm{s} }{\rm{.t} }{\rm{.} } \ f(x,u,t)-\dot x = 0,\ x(t_0)=x_0,\ \psi[x(t_f),t_f]=0$;
必要条件:
①$x,\lambda$满足正则方程:$\boxed{\dot \lambda = - \frac{ {\partial H} }{ {\partial x} },\ \dot x = \frac{ {\partial H} }{ {\partial \lambda } } }$;
②横截条件:$\boxed{x({t_0}) = 0,\ \psi [x({t_f}),{t_f}] = 0,\ \lambda ({t_f}) = \frac{ {\partial \phi } }{ {\partial x({t_f})} } + \gamma \frac{ {\partial \psi } }{ {\partial x({t_f})} } }$;
③控制方程:$\boxed{H({x^},{u^},{\lambda ^},t) = \mathop {\operatorname{min} }\limits_{u \in \Omega } H({x^},u,{\lambda ^},t)}$;
④$t_f$自由:$\boxed{H({t_f}) = - \frac{ {\partial \phi } }{ {\partial {t_f} } } - {\gamma ^T}({t_f})\frac{ {\partial \psi } }{ {\partial {t_f} } } }$;
附加必要条件:
①若$t_f$固定,$H$不显含$t$,则$H$须满足在时间区间上为常值,$H[x^(t),u^(t),\lambda^*(t)]=c_1,\ t\in[t_0,t_f]$;
②若$t_f$自由,$H$不显含$t$,则$H$须满足在时间区间上为0,$H[x^(t),u^(t),\lambda^*(t)]=0,\ t\in[t_0,t_f]$;
4.极小值原理应用——时间最优控制(TOC):$\mathop {\operatorname{min} }\limits_{\left| u \right| \le 1} J = \int_0^{ {t_1} } {dt} = {t_1}, \ \ {\rm{s} }{\rm{.t} }{\rm{.} }\begin{array}{{20}{c} }
{ { {\dot x}_1} = {x_2},\ {x_1}(0) = - 8,\ {x_1}({t_1}) = 0}\
{ { {\dot x}_2} = u,\ {x_2}(0) = 0,\ {x_2}({t_1}) = 0}
\end{array}$;
找寻时间最短到达原点的控制;
协态方程$\left{ \begin{array}{l}
{ {\dot \lambda }_1} = 0\
{ {\dot \lambda }_2} = - {\lambda _1}
\end{array} \right. \Rightarrow \left{ \begin{array}{l}
{\lambda _1} = c\
{\lambda _2} = - ct + {c_1}
\end{array} \right.$;
$H=1+\lambda_1 x_2+\lambda_2 u$,$\mathop {\operatorname{min} }\limits_{\left| u \right| \le 1} H \Rightarrow {u^} = \left{ \begin{array}{l}
1,\ {\lambda _2} < 0\
-1,\ {\lambda _2} > 0
\end{array} \right.$;(Bang-Bang控制),实际系统中使用继电器实现;
情形1:$u=1$,$\left{ \begin{array}{l}
{ {\dot x}1} = {x_2}\
{ {\dot x}_2} = 1
\end{array} \right. \Rightarrow \left{ \begin{array}{l}
{x_1} = 0.5{t^2} + {x{20} }t + {x_{10} }\
{x_2} = t + {x_{20} }
\end{array} \right. \Rightarrow {x_1} = 0.5x_2^2 + c$,为相平面上一组开口向右的抛物线,由于$\dot x_2=1$,取从下往上的方向;
情形2:$u=-1$,$\Rightarrow x_1=0.5x_2^2+c$,为相平面上一组开口向左的抛物线,由于$\dot x_2=-1$,取从上往下的方向;
切换:曲线把相平面分为两部分;
切换曲线(开关曲线):$\boxed{\gamma = \left{ {\left. {({x_1},{x_2})} \right
{x_1} = - 0.5{x_2}\left
{ {x_2} } \right
} \right} }$
5.极小值原理应用——燃料最优控制(FOC):$\mathop {\operatorname{min} }\limits_{\left| u \right| \le 1} J = \int_0^{ {t_1} } {\left| u \right|dt} ,\;\;{\rm{s} }.{\rm{t} }.\begin{array}{{20}{c} }
{ { {\dot x}1} = {x_2},\;{x_1}(0) = {x{10} },\;{x_1}({t_1}) = 0}\
{ { {\dot x}2} = u,\;{x_2}(0) = {x{20} },\;{x_2}({t_1}) = 0}
\end{array}$;
$H=|x|+\lambda_1 x_2+\lambda_2 u$,$\mathop {\operatorname{min} }\limits_{\left| u \right| \le 1} H \Rightarrow {u^} = \left{ \begin{array}{l}
1,{\lambda _2} <-1\
0, -1 < {\lambda _2} < 1\
-1,{\lambda _2} > 1
\end{array} \right.$($\lambda_2$取-1,1时u不确定);(Bang-off-Bang控制);
${u^*}(t) = \left{ \begin{array}{l}
1,\forall ({x_{10} },{x_{20} }) \in {\gamma _ + }\
-1,\forall ({x_{10} },{x_{20} }) \in {\gamma _ - }\
0,\forall ({x_{10} },{x_{20} }) \in {S_2} \cup {S_4}
\end{array} \right.$(0为水平往原点移动),当$\forall ({x_{10} },{x_{20} }) \in {S_1} \cup {S_3}$严格最优控制不存在,$\epsilon-FOC$次优解仍存在;
6.加权时间-燃料最优控制:$\mathop {\operatorname{min} }\limits_{\left| u \right| \le 1} J = \int_0^{ {t_1} } {\left| {\rho + \left| {u(t)} \right|} \right|dt} ,\;\;{\rm{s} }.{\rm{t} }.\begin{array}{{20}{c} }
{ { {\dot x}1} = {x_2},\;{x_1}(0) = {x{10} },\;{x_1}({t_1}) = 0}\
{ { {\dot x}2} = u,\;{x_2}(0) = {x{20} },\;{x_2}({t_1}) = 0}
\end{array}$;
$H=\rho +|u(t)|+\lambda_1 x_2+\lambda_2 u$;最优控制${u^*}(t) = \left{ \begin{array}{l}
1,\;{\lambda _2} < - 1\
0,\; - 1 < {\lambda _2} < 1\
-1,\;{\lambda _2} > 1\
\left[ {0,1} \right],\;{\lambda _2} = - 1\
\left[ { - 1,0} \right],\;{\lambda _2} = 1
\end{array} \right.$;
两条分界轨线:$\boxed{\gamma = \left{ {\left. {({x_1},{x_2})} \right
{x_1} = - 0.5{x_2}\left
{ {x_2} } \right
} \right} }$;$\boxed{\mu = \left{ {\left. {({x_1},{x_2})} \right
{x_1} = - \frac{ {\rho + 4} }{ {2\rho } }{x_2}\left
{ {x_2} } \right
} \right} }$;
各区域的最优控制${u^*}(t) = \left{ \begin{array}{l}-1,\;({x_1},{x_2}) \in {R_1}\
0,\;({x_1},{x_2}) \in {R_2} \cup {R_4}\
1,\;({x_1},{x_2}) \in {R_3}
\end{array} \right.$;
4.动态规划 DP
1.${J_n}(x) = \mathop {\operatorname*{min} }\limits_{ {S_n}(x)} \left{ {d\left[ {x,{S_n}(x)} \right] + {J_{n - 1} }\left[ { {S_n}(x)} \right]} \right}$;
2.问题描述:$u^(k) \in \Omega$,$x(k+1)=f[x(k),u(k),k],k=0,1,2,\cdots,N-1$,$x(0)=x_0$,求$x^(k)$使指标$J = \phi \left[ {x(N),N} \right] + \sum\limits_{k = 0}^{k - 1} {L\left[ {x(k),u(k),k} \right]} $最小;
3.定理4.1:递归方程$J_{N - k}^\left[ {x(k),k} \right] = \mathop {\operatorname{min} }\limits_{u(k) \in \Omega } \left{ {L\left[ {x(k),u(k),k} \right] + J_{N - k - 1}^\left[ {x(k - 1),k - 1} \right]} \right}$, $k=0,1,2,\cdots,N-1$,初值为$J_0^\left[ {x(N),N} \right] = \phi \left[ {x(N),N} \right]$;始于末端,终于始端,逆向递推;
4.计算步骤:
定义N阶最优控制$u^(N-1)$:$J_1^\left[ {x(N - 1)} \right] = \mathop {\operatorname{min} }\limits_{u(N - 1) \in \Omega } \left{ {L\left[ {x(N - 1),u(N - 1),N - 1} \right] + J_0^\left[ {x(N)} \right]} \right} $ $\Rightarrow {u^}(N - 1) = {u^}\left[ {x(N - 1)} \right],J_1^*\left[ {x(N - 1)} \right]$;
定义N-1阶最优控制$u^(N-2)$:$J_2^\left[ {x(N - 2)} \right] = \mathop {\operatorname{min} }\limits_{u(N - 2) \in \Omega } \left{ {L\left[ {x(N - 2),u(N - 2),N - 2} \right] + J_1^\left[ {x(N-1)} \right]} \right} $ $\Rightarrow {u^}(N - 2) = {u^}\left[ {x(N - 2)} \right],J_2^*\left[ {x(N - 2)} \right]$;
定义2阶最优控制$u^(1)$:$J_{N-1}^\left[ {x(1)} \right] = \mathop {\operatorname{min} }\limits_{u(1) \in \Omega } \left{ {L\left[ {x(1),u(1),1} \right] + J_{N-2}^\left[ {x(2)} \right]} \right} $ $\Rightarrow {u^}(N - 2) = {u^}\left[ {x(1)} \right],J_{N-1}^*\left[ {x(2)} \right]$;
定义1阶最优控制$u^(0)$:$J_N^\left[ {x(0)} \right] = \mathop {\operatorname{min} }\limits_{u(0) \in \Omega } \left{ {L\left[ {x(0),u(0),0} \right] + J_{N-1}^\left[ {x(1)} \right]} \right} $ $\Rightarrow {u^}(0) = {u^}\left[ {x(0)} \right],J_N^*\left[ {x(0)} \right]$;
根据$x(0)$可依次计算$u^(0),x^(1),u^(1),\cdots,x^(N-1),u^*(N-1)$及最小消耗;
5.线性二次型最优控制LQR
1.线性二次型状态调节器:$\mathop {\operatorname*{min} }\limits_{u(t)} J = \frac{1}{2}{x^T}({t_f})Fx({t_f}) + \frac{1}{2}\int_{ {t_0} }^{ {t_f} } {\left[ { {x^T}Q(t)x + {u^T}R(t)u} \right]dt} $,$F=F^T \ge 0,\ Q(t)=Q^T(t)> 0,\ R(t)=R^T(t)>0$,${\rm{s} }.{\rm{t} }.\;\dot x(t) = Ax + Bu,x(0) = {x_0}$;
2.线性二次型跟踪问题:$\mathop {\operatorname*{min} }\limits_{u(t)} J = \frac{1}{2}{e^T}({t_f})Fe({t_f}) + \frac{1}{2}\int_{ {t_0} }^{ {t_f} } {\left[ { {e^T}Q(t)e + {u^T}R(t)u} \right]dt} $,
3.线性二次型系统物理意义:
4.线性二次型最优状态调节器:$\mathop {\operatorname*{min} }\limits_{u(t)} J = \frac{1}{2}{x^T}({t_f})Fx({t_f}) + \frac{1}{2}\int_{ {t_0} }^{ {t_f} } {\left( { {x^T}Qx + {u^T}Ru} \right)dt},\ {\rm{s} }.{\rm{t} }.\;\dot x(t) = Ax + Bu$;
定理5.1:充要条件$\boxed{u^*(t)=-R^{-1}(t)B^T(t)P(t)x(t)}$;
P是对称半正定阵,$P=P^T \ge 0$,满足微分黎卡提方程DRE:$\boxed{-\dot P=PA+A^TP+Q-PBR^{-1}B^TP}$;
边界条件$P(t_f)=F$;
对应的最优性能指标$J^*(x_0)=0.5x_0^TP(t_0)x_0$;
定理5.2:P存在且唯一,则该问题最优控制存在且唯一;
5.若控制对象$x(t_f)=0$则$J=x^TFx+\int_{ {t_0} }^{ {t_f} } {\left( { {x^T}Qx + {u^T}Ru} \right)dt}$,F为补偿函数;
IDRE:$\dot P^{-1}=P^{-1}A^T+AP^{-1}-PR^{-1}B^T+P^{-1}QP^{-1}$,其中$P(t_f)=0$;
6.无限时间状态调节器:$\mathop {\operatorname*{min} }\limits_{u(t)} J = \frac{1}{2}\int_{ {t_0} }^{ {\infty} } {\left( { {x^T}Qx + {u^T}Ru} \right)dt}$,$Q(t)=Q^T(t)\ge 0,\ R(t)=R^T(t)\ge 0$,${\rm{s} }.{\rm{t} }.\;\dot x(t) = Ax + Bu,\ x(0)=x_0$,$u(t)$无边界;
定理5.3:若线性系统${\bf{A},\bf{B}}$完全可控,则存在唯一的最优控制$\boxed{u^(t)=-R^{-1}(t)B^T(t)\bar P(t)x(t)}$,当$\bar P(t) = \mathop {\lim }\limits_{ {t_f} \to \infty } P(t),\ \bar P(t)=\bar P^T(t)\ge 0$,且$P(t)$满足DRE:$-\dot P=PA+A^TP+Q-PBR^{-1}B^TP$,边界条件$P(t_f)=0$,此时最优性能指标$J^=\frac{1}{2}x^T(t_0)\bar P(t_0)x(t_0)$;
7.无限时间线性定常(时不变)二次型最优控制系统:$\mathop {\operatorname*{min} }\limits_{u(t)} J = \frac{1}{2}\int_{ {0} }^{ {\infty} } {\left( { {x^T}Qx + {u^T}Ru} \right)dt}$;
定理5.4:矩阵${\bf{D} }$满足分解${\bf{D} }{ {\bf{D} }^T} = {\bf{Q} }$及代数黎卡提方程ARE:$\boxed{PA+A^TP+Q-PBR^{-1}B^TP=0}$,则$\bf{P}$对称且正定($\bf{P}=\bf{P^T}>0$)$ \Leftrightarrow $ ${\bf{A},\bf{D}}$完全能观;
定理5.5:对线性定常(时不变)系统,若${\bf{A},\bf{B}}$完全能控且${\bf{A},\bf{D}}$完全能观,$\bf{D}$满足分解${\bf{D} }{ {\bf{D} }^T} = {\bf{Q} }$,则存在唯一的最优控制$u^(t)=-R^{-1}B^TPx(t)$,其中$\bf{P}$满足ARE:$PA+A^TP+Q-PBR^{-1}B^TP=0$,此时最优性能指标$J^=\frac{1}{2}x_0^TPx_0$;
定理5.6:最优闭环系统状态调节器具备全局渐近稳定性GAS:$\boxed{\dot x(t)=(A-BR^{-1}B^TP)x(t)}$,$x(0)=x_0$;${\bf{A},\bf{B}}$能控性保证最优解存在。${\bf{A},\bf{D}}$能观性保证了系统GAS;
当系统不能控的状态收敛,称为可稳;当系统不能观的状态收敛,称为可检;
6.最优输出跟踪
1.有限时间最优输出跟踪问题:$\mathop {\operatorname*{min} }\limits_{u(t)} J = \frac{1}{2}{e^T}({t_f})Fe({t_f}) + \frac{1}{2}\int_{ {t_0} }^{ {t_f} } {\left( { {e^T}Qe + {u^T}Ru} \right)dt} $,${\rm{s} }.{\rm{t} }.\;\dot x(t) = Ax + Bu,y=Cx,e(t)=y_d-y,x(t_0)=x_0$;
构造$H=\frac{1}{2}(y_d-Cx)^TQ(y_d-Cx)+\frac{1}{2}u^TRu+\lambda^TAx+\lambda^TBu$,$\frac{ {\partial H} }{ {\partial u} } = Ru + {B^T}\lambda = 0$;
$u^*=-R^{-1}B^T\lambda,\ \dot \lambda=-\frac{ {\partial H} }{ {\partial x} }=-C^TQCx+C^TQy_d-A^T\lambda,\ \lambda=Px-g(t)$,$\dot x=Ax-BR^{-1}B^T\lambda,\ \lambda(t_f)=C^TQCx(t_f)-C^TQy_d$;
2.定理6.1:当${\bf{A},\bf{C}}$完全能观,存在最优控制$u^*(t)=-R^{-1}B^T(Px-g)$,当$P(t)=P^T(t) \ge 0$,$g(t)$满足$-\dot P(t)=PA+A^TP-PBR^{-1}B^TP+C^TQC$,$-g(t_f)=C^TQy_d+(A-BR^{-1}B^TP)^Tg$,边界条件为$P(t_f)=C^T(t_f)FC(t_f),\ g(t_f)=C^T(t_f)Fy_d(t_f)$;
3.定理6.2:对LTI系统,若${\bf{A},\bf{B}}$完全能控,${\bf{A},\bf{C}}$完全能观,则存在唯一最优控制$\hat u(t) = - {R^{ - 1} }{B^T}Px(t) + {R^{ - 1} }{B^T}g$,其中P满足ARE:$PA+A^TP+Q-PBR^{-1}B^TP=0$,$g = {\left[ {PB{R^{ - 1} }{B^T} - {A^T} } \right]^{ - 1} }{C^T}Q{y_d}$;
4.带有给定稳定度的状态调节:$\mathop {\operatorname*{min} }\limits_{u(t)} J = \frac{1}{2}\int_{ {t_0} }^{ {\infty} } {e^{2\alpha t}\left( { {x^T}Qx + {u^T}Ru} \right)dt}$,${\rm{s} }.{\rm{t} }.\;\dot x(t) = Ax + Bu,x(t_0)=x_0$;
当${\bf{A},\bf{B}}$能控且${\bf{A},\bf{D}}$能观:$u^*=-R^{-1}B^Tx$,$(A^T+\alpha I)P+P(A+\alpha I)+Q-PBR^{-1}B^TP=0$;
-
最优控制基础-复习例题
最优控制基础 - 复习例题
变分法与最优控制
求泛函$J(x) = \int_0^{ {t_f} } {\sqrt {1 + { {\dot x}^2}(t)} dt} $的极值,要求:(1)$x(0)=1$,$x(t_f)$位于曲线$\theta(t)=-2t+3$上;(2)$x(0)=5$,$x(t_f)$位于曲线$x^2(t)+(t-5)^2=4$上。
(1)$\sqrt{1+\dot x^2}+\frac{\dot x}{\sqrt{1+\dot x^2} }(-2-\dot x)=0$,得${\left. {\dot x} \right
_{ {t_f} } } = \frac{1}{2}$,代入边界条件$x(0)=1$得 $x(t) = \frac{1}{2}t+1$,从而$t_f=\frac{4}{5}$,$J^*=\frac{2\sqrt{5} }{5}$;
(2)$L + {\left. {\frac{ {\partial L} }{ {\partial \dot x} }(\theta - \dot x)} \right
_{ {t_f} } } = 0$,$2\theta \dot \theta+2(t_f-5)=0$,得${\left. {\dot \theta } \right
_{ {t_f} } } = \frac{ {5 - {t_f} } }{ { { {\left. \theta \right
}_{ {t_f} } } } } = \frac{ {5 - {t_f} } }{ {x({t_f})} }$,$x=ct+5$,$\sqrt{1+c^2}+\frac{c}{\sqrt{1+c^2} }\left( \frac{5-t_f}{ct_f+5}-c \right)=0$,由图或直接解得$c=-1$,则极小值$J^=5\sqrt{2}-2$,极大值$J^=5\sqrt{2}+2$;“(0,5)出发到圆的最短距离曲线(即与圆心连接)”;
设受控系统为\(\left\{ \begin{array}{l}{ {\dot x}_1}(t) = {x_2}(t) + {u_1}(t), \ {x_1}(0) = 1\\{ {\dot x}_2}(t) = {u_2}(t), \ {x_2}(0) = 1\end{array} \right.\),性能指标为$J(u) = 0.5\int_0^2 {\left[ {u_1^2(t) + u_2^2(t)} \right]dt} $,目标集为$x_1(2)=0$,求最优控制$u^*(t)$使$J(u)$为最小。
构造哈密顿函数:$H= 0.5(u_1^2 + u_2^2) + \lambda_1(x_2 + u_1) + \lambda_2 u_2$。控制方程由 $\frac{\partial H}{\partial u_1} = 0$ , $\frac{\partial H}{\partial u_2} = 0$ 得到:
\(\left\{ \begin{array}{l}
u_1^* = - {\lambda _1}\\
u_2^* = - {\lambda _2}
\end{array} \right.\);
协状态方程:
\(\left\{ \begin{array}{l}
{ {\dot \lambda }_1} = - \frac{ {\partial H} }{ {\partial {x_1} } } = 0\\
{ {\dot \lambda }_2} = - \frac{ {\partial H} }{ {\partial {x_2} } } = - {\lambda _1}
\end{array} \right.\),
积分得:$\lambda_1(t) = c_1,\ \lambda_2(t) = -c_1 t + c_2$;
代入状态方程得到:
\(\left\{ \begin{array}{l}
{ {\dot x}_1} = {x_2} - {c_1}\\
{ {\dot x}_2} = {c_1}t - {c_2}
\end{array} \right.\),
对状态方程积分,并由初始条件 $x_1(0)=1, x_2(0)=1$得到:
\(\left\{ \begin{array}{l}
{x_1}(t) = \frac{1}{6}{c_1}{t^3} - \frac{1}{2}{c_2}{t^2} + (1 - {c_1})t + 1\\
{x_2}(t) = \frac{1}{2}{c_1}{t^2} - {c_2}t + 1
\end{array} \right.\);
由边界条件 $x_1(2)=0,\ \lambda_2(2)=0$,解得$c_1 = \frac{9}{14},\ c_2 = \frac{9}{7}$;
则最优控制为:
\(\left\{ \begin{array}{l}
u_1^*(t) = - \frac{9}{ {14} }\\
u_2^*(t) = \frac{9}{ {14} }t - \frac{9}{7}
\end{array} \right.\),最优性能指标$J^*=\frac{27}{28}$。
求泛函$J = \int_0^{\frac{\pi }{2} } {({ {\dot x}^2} - {x^2})dt} $极值,边界条件$x(0)=2,x(\frac{\pi}{2})=2$;
求泛函$J = \int_0^{\frac{\pi }{2} } {(2x_1x_2+{ {\dot x_1^2} }+\dot x_2^2)dt} $极值,边界条件$x_1(0)=2,x_1(\frac{\pi}{2})=1,x_2(0)=0,x_2(\frac{\pi}{2})=-1$;
$\theta=0.5(t-5)^2-0.5$,$J(x) = \int_0^{ {t_f} } {\sqrt {1 + { { x}^2}(t)} dt} $,$L=\sqrt{1+x^2}$,$x(t_f)=c_1t+c_2$,$x(0)=0$;
$c_2=0,L=\sqrt{1+c_1^2}$,$\sqrt{1+c_1^2}+\frac{c_1}{\sqrt{1+c_1^2} }\left( t_f-5-c_1 \right)=0$,且$c_1t_f=0.5(t_f-5)^2-0.5$,得$c_1=0.5$;
求有约束泛函极值$J = \frac{1}{2}\int_0^2 { {u^2}(t)dt} $极值,特征方程(双积分系统)$\dot x(t) = \left[ {\begin{array}{{20}{c} }
0&1\
0&0
\end{array} } \right]x(t) + \left[ {\begin{array}{{20}{c} }
0\
1
\end{array} } \right]u$,边界条件$x(0) = {\left[ {\begin{array}{{20}{c} }
1&1
\end{array} } \right]^T},x(2) = {\left[ {\begin{array}{{20}{c} }
0&0
\end{array} } \right]^T}$;
需要计算机求解;
$\mathop {\operatorname*{\min} }\limits_{u(t)} J = 0.5{\left[ { {x_1}(2) - 5} \right]^2} + 0.5{\left[ { {x_2}(2) - 5} \right]^2} + \frac{1}{2}\int_0^2 { {u^2}(t)dt} $,${ {\dot x}_1}(t) = {x_2}(t),{ {\dot x}_2}(t) = - {x_2}(t) + u(t)$,${x_1}(0) = {x_2}(0) = 0,{x_2}$自由;
$\mathop {\operatorname*{\min} }\limits_{u(t)} J = \frac{1}{2}\int_0^1 { {u^2} } (t)dt$,s.t.${ {\dot x}_1}(t) = {x_2}(t),{ {\dot x}_2}(t) = u(t)$,${x_1}(0) = {x_2}(0) = 0,{x_1}(1) + {x_2}(1) = 1$;
极小值原理
$\mathop {\operatorname{\min} }\limits_{\left| u \right| \le 1} J = \int_0^{ {t_f} } {\left| {2 + \left| {u(t)} \right|} \right|dt} ,\;\;{\rm{s} }.{\rm{t} }.\left{ \begin{array}{l}
{ {\dot x}_1} = {x_2},\;{x_1}(0) = - 8,\;{x_1}({t_1}) = 0\
{ {\dot x}_2} = u,\;{x_2}(0) = - 4,\;{x_2}({t_1}) = 0
\end{array} \right.$,求解$u^$及$t_f^*$;
$H=|2+|u||+\lambda_1 x_2+\lambda_2 u$,$\left{ \begin{array}{l}
{ {\dot \lambda }_1} = 0\
{ {\dot \lambda }_2} = - c
\end{array} \right. \to \left{ \begin{array}{l}
{\lambda _1} = ct\
{\lambda _2} = - ct + {c_1}
\end{array} \right.$,由加权时间-燃料最优控制知${u^} = \left{ \begin{array}{l}
1,{\lambda _2} <-1\
0, -1 < {\lambda _2} < 1\
-1,{\lambda _2} > 1
\end{array} \right.$,最终控制量$u^(t_f)=-1$,则由图,设到达B点、C点时间分别为$t_B$、$t_C$,列出横截条件$H(t_f)=2+1-\lambda_2(t_f)=0$,$\left{ \begin{array}{l}
{\lambda _2}({t_B}) = - c{t_B} + {c_1} = - 1\
{\lambda _2}({t_C}) = - c{t_C} + {c_1} = 1\
{\lambda _2}({t_f}) = - c{t_f} + {c_1} = 3
\end{array} \right. \Rightarrow {t_f} + {t_B} = 2{t_C}$;
AB段:$u=1$,$x_1=0.5x_2^2+c$,由${x_1}(0) = - 8,{x_2}(0) = - 4$解得$c=-16$,此时$\left{ \begin{array}{l}
{ {\dot x}_1} = {x_2}\
{ {\dot x}_2} = 1
\end{array} \right. \Rightarrow \left{ \begin{array}{l}
{x_1} = 0.5{t^2} -4t -8\
{x_2} = t -4
\end{array} \right.$;
开关曲线第二象限部分$\mu_-=-\frac{2+4}{2*2}x_2^2=-1.5x_2^2$,联立$x_1=0.5x_2^2-16$解得$B(-12,2\sqrt{2})$,对于B点仍满足$\left{ \begin{array}{l}
{x_1}(t_B) = 0.5{t_B^2} -4t_B -8\
{x_2}(t_B) = t_B -4
\end{array} \right.$,解得$t_B=4+2\sqrt{2}$;
BC段:$u=0$,由C在$x_1=-0.5x_2^2$上易得$C(-4,2\sqrt{2})$,此时$\left{ \begin{array}{l}
{ {\dot x}_1} = {x_2}\
{ {\dot x}_2} = 1
\end{array} \right. \Rightarrow \left{ \begin{array}{l}
{x_1} = (t_B-4)(t-t_B)+x_1(t_B)\
{x_2} = t_B -4
\end{array} \right.$,对于C点也成立;
CO段:$\left{ \begin{array}{l}
{ {\dot x}_1} = {x_2}\
{ {\dot x}_2} = -1
\end{array} \right. \Rightarrow \left{ \begin{array}{l}
{x_1} = -\frac{1}{2}(t-t_C)^2+x_2(t_C)(t-t_C)+x_1(t_C)\
{x_2} = -(t-t_C)+x_2(t_C)=-t+t_B+t_C-4
\end{array} \right.$,由$x_1(t_f)=-\frac{1}{2}(t_f-t_C)^2+x_2(t_C)(t_f-t_C)+x_1(t_C)=0,\ x_2(t_f)=-t_f+t_B+t_C-4=0$,联立解得$t_C=4+4\sqrt{2}$,$t_f^*=4+6\sqrt{2}$;
则控制律${u^*} = \left{ \begin{array}{l}-1,\;0\le t < 4+2\sqrt{2}\
0,\;4+2\sqrt{2}\le t < 4+4\sqrt{2}\
1,\; 4+4\sqrt{2}\le t \le 4+6\sqrt{2}
\end{array} \right.$.
$\mathop {\operatorname*{\min} }\limits_{\left
u \right
\le 1} J = 0.5\int_0^1 {(x_1^2 + {u^2})dt} $,s.t.${ {\dot x}_1} = {x_2},{ {\dot x}_2} = - {x_2} + u,x(0) = 1$;
$\mathop {\operatorname*{\min} }\limits_{u(t)} J = \int_0^1 (x + u) dt$,s.t.$\dot{x} = x - u$, $x(0) = 5$, $0.5 \le u \le 1$;
动态规划
设离散系统方程$x(k+1)=x(k)+u(k)$,$x(0)=0$,$x(4)=1$,式中 $u(k)\in \Omega={-1,0,+1}$。性能指标$J = \sum\limits_{k = 0}^3 {\left[ { {x^2}(k) + {u^2}(k)} \right]} $,求使性能指标为极小的最优控制序列$u^(k),k=0,1,2,3$,以及最优轨线$x^(k),k=0,1,2,3,4$。
$\mathop {\operatorname{\min} }\limits_{ {u^}(k)} J = {x^2}(3) + \sum\limits_{k = 0}^2 {\left[ { {x^2}(k) + {u^2}(k)} \right]} ,{\rm{ s} }{\rm{.t} }{\rm{. } }x(k + 1) = 2x(k) + u(k),x(0) = 1$;
$\mathop {\operatorname{\min} }\limits_{ {u^}(k)} J = {x^2}(3) + \sum\limits_{k = 0}^3 {\left[ {3x(k) - u(k)} \right]} ,{\rm{ s} }{\rm{.t} }{\rm{. } }x(k + 1) = 0.5x(k) + 0.3u(k),0 \le u(k) \le x(k)$
线性二次型最优控制
$\min_{u(t)} J = 0.5x^2(t_f) + \int_{t_0}^{t_f} [x^2(t) + u^2(t)] dt$,s.t.$\dot{x} = u, x(t_0) = x_0$,$P(t) = \frac{6 - 2e^{2(t-t_f)} }{3 + e^{2(t-t_f)} }$;
$\min_{u(t)} J = \int_0^\infty [x_2^2(t) + 0.25 u^2(t)] dt$,s.t.$\dot{x}_1(t) = u(t), x_1(0) = 0$,$\dot{x}_2(t) = x_1(t), x_2(0) = 1$;
$\min_{u(t)} J = 0.5 \int_0^\infty [x^T(t)x(t) + u^2(t)] dt$,s.t.$\dot{x}_1(t) = x_1(t), x_1(0) = 1$,$\dot{x}_2(t) = x_2(t) + u(t), x_2(0) = 0$;
$\min_{u(t)} J = \int_0^\infty e^{2t} [x_1^2(t) + u^2(t)] dt$,s.t.$\dot{x}_1(t) = x_2(t)$,$\dot{x}_2(t) = u(t)$;
最优输出跟踪
$\min_{u^*} J = \frac{1}{2} \int_0^{10} { 2[y - 0.2 \sin(\pi t)]^2 + 0.002u^2 } dt$,s.t.$\dot{x}_1 = x_2, x_1(0) = 1$,$\dot{x}_2 = 2x_1 - x_2 + u, x_2(0) = 1$,$y = x_1$;
系统$\dot{x}1 = x_2, \ \dot{x}_2 = -2x_2 + u, \ y = x_1$,性能指标$J = \frac{1}{2} \int{0}^{\infty} (e^2 + u^2) dt$(其中 $e = 1 - y$)确定近似跟踪控制律;
-
-
Manage blog comments with Giscus
Giscus is a free comments system powered without your own database. Giscus uses the Github Discussions to store and load associated comments based on a chosen mapping (URL, pathname, title, etc.).
To comment, visitors must authorize the giscus app to post on their behalf using the GitHub OAuth flow. Alternatively, visitors can comment on the GitHub Discussion directly. You can moderate the comments on GitHub.
Prerequisites
Create a github repo
You need a GitHub repository first. If you gonna use GitHub Pages for hosting your website, you can choose the corresponding repository (i.e., [userID].github.io)
The repository should be public, otherwise visitors will not be able to view the discussion.
Turn on Discussion feature
In your GitHub repository Settings, make sure that General > Features > Discussions feature is enabled.
Activate Giscus API
Follow the steps in Configuration guide. Make sure the verification of your repository is successful.
Then, scroll down from the manual page and choose the Discussion Category options. You don’t need to touch other configs.
Copy _config.yml
Now, you get the giscus script. Copy the four properties marked with a red box as shown below:
Paste those values to _config.yml placed in the root directory.
# External API
giscus_repo: "[ENTER REPO HERE]"
giscus_repoId: "[ENTER REPO ID HERE]"
giscus_category: "[ENTER CATEGORY NAME HERE]"
giscus_categoryId: "[ENTER CATEGORY ID HERE]"
None
· 2024-02-03
-
-
Classic Literature #2: Don Quixote
About the book
Author: Miguel de Cervantes
Original title: El ingenioso hidalgo don Quixote de la Mancha
Country: Spain
Genre: Novel
Publication date:
1605 (Part One)
1615 (Part Two)
Chapter I.
In a village of La Mancha, the name of which I have no desire to call to mind, there lived not long since one of those gentlemen that keep a lance in the lance-rack, an old buckler, a lean hack, and a greyhound for coursing. An olla of rather more beef than mutton, a salad on most nights, scraps on Saturdays, lentils on Fridays, and a pigeon or so extra on Sundays, made away with three-quarters of his income. The rest of it went in a doublet of fine cloth and velvet breeches and shoes to match for holidays, while on week-days he made a brave figure in his best homespun. He had in his house a housekeeper past forty, a niece under twenty, and a lad for the field and market-place, who used to saddle the hack as well as handle the bill-hook. The age of this gentleman of ours was bordering on fifty; he was of a hardy habit, spare, gaunt-featured, a very early riser and a great sportsman. They will have it his surname was Quixada or Quesada (for here there is some difference of opinion among the authors who write on the subject), although from reasonable conjectures it seems plain that he was called Quexana. This, however, is of but little importance to our tale; it will be enough not to stray a hair’s breadth from the truth in the telling of it.
You must know, then, that the above-named gentleman whenever he was at leisure (which was mostly all the year round) gave himself up to reading books of chivalry with such ardour and avidity that he almost entirely neglected the pursuit of his field-sports, and even the management of his property; and to such a pitch did his eagerness and infatuation go that he sold many an acre of tillageland to buy books of chivalry to read, and brought home as many of them as he could get. But of all there were none he liked so well as those of the famous Feliciano de Silva’s composition, for their lucidity of style and complicated conceits were as pearls in his sight, particularly when in his reading he came upon courtships and cartels, where he often found passages like “the reason of the unreason with which my reason is afflicted so weakens my reason that with reason I murmur at your beauty;” or again, “the high heavens, that of your divinity divinely fortify you with the stars, render you deserving of the desert your greatness deserves.” Over conceits of this sort the poor gentleman lost his wits, and used to lie awake striving to understand them and worm the meaning out of them; what Aristotle himself could not have made out or extracted had he come to life again for that special purpose. He was not at all easy about the wounds which Don Belianis gave and took, because it seemed to him that, great as were the surgeons who had cured him, he must have had his face and body covered all over with seams and scars. He commended, however, the author’s way of ending his book with the promise of that interminable adventure, and many a time was he tempted to take up his pen and finish it properly as is there proposed, which no doubt he would have done, and made a successful piece of work of it too, had not greater and more absorbing thoughts prevented him.
Many an argument did he have with the curate of his village (a learned man, and a graduate of Siguenza) as to which had been the better knight, Palmerin of England or Amadis of Gaul. Master Nicholas, the village barber, however, used to say that neither of them came up to the Knight of Phoebus, and that if there was any that could compare with him it was Don Galaor, the brother of Amadis of Gaul, because he had a spirit that was equal to every occasion, and was no finikin knight, nor lachrymose like his brother, while in the matter of valour he was not a whit behind him. In short, he became so absorbed in his books that he spent his nights from sunset to sunrise, and his days from dawn to dark, poring over them; and what with little sleep and much reading his brains got so dry that he lost his wits. His fancy grew full of what he used to read about in his books, enchantments, quarrels, battles, challenges, wounds, wooings, loves, agonies, and all sorts of impossible nonsense; and it so possessed his mind that the whole fabric of invention and fancy he read of was true, that to him no history in the world had more reality in it. He used to say the Cid Ruy Diaz was a very good knight, but that he was not to be compared with the Knight of the Burning Sword who with one back-stroke cut in half two fierce and monstrous giants. He thought more of Bernardo del Carpio because at Roncesvalles he slew Roland in spite of enchantments, availing himself of the artifice of Hercules when he strangled Antaeus the son of Terra in his arms. He approved highly of the giant Morgante, because, although of the giant breed which is always arrogant and ill-conditioned, he alone was affable and well-bred. But above all he admired Reinaldos of Montalban, especially when he saw him sallying forth from his castle and robbing everyone he met, and when beyond the seas he stole that image of Mahomet which, as his history says, was entirely of gold. To have a bout of kicking at that traitor of a Ganelon he would have given his housekeeper, and his niece into the bargain.
In short, his wits being quite gone, he hit upon the strangest notion that ever madman in this world hit upon, and that was that he fancied it was right and requisite, as well for the support of his own honour as for the service of his country, that he should make a knight-errant of himself, roaming the world over in full armour and on horseback in quest of adventures, and putting in practice himself all that he had read of as being the usual practices of knights-errant; righting every kind of wrong, and exposing himself to peril and danger from which, in the issue, he was to reap eternal renown and fame. Already the poor man saw himself crowned by the might of his arm Emperor of Trebizond at least; and so, led away by the intense enjoyment he found in these pleasant fancies, he set himself forthwith to put his scheme into execution.
The first thing he did was to clean up some armour that had belonged to his great-grandfather, and had been for ages lying forgotten in a corner eaten with rust and covered with mildew. He scoured and polished it as best he could, but he perceived one great defect in it, that it had no closed helmet, nothing but a simple morion. This deficiency, however, his ingenuity supplied, for he contrived a kind of half-helmet of pasteboard which, fitted on to the morion, looked like a whole one. It is true that, in order to see if it was strong and fit to stand a cut, he drew his sword and gave it a couple of slashes, the first of which undid in an instant what had taken him a week to do. The ease with which he had knocked it to pieces disconcerted him somewhat, and to guard against that danger he set to work again, fixing bars of iron on the inside until he was satisfied with its strength; and then, not caring to try any more experiments with it, he passed it and adopted it as a helmet of the most perfect construction.
He next proceeded to inspect his hack, which, with more quartos than a real and more blemishes than the steed of Gonela, that “tantum pellis et ossa fuit,” surpassed in his eyes the Bucephalus of Alexander or the Babieca of the Cid. Four days were spent in thinking what name to give him, because (as he said to himself) it was not right that a horse belonging to a knight so famous, and one with such merits of his own, should be without some distinctive name, and he strove to adapt it so as to indicate what he had been before belonging to a knight-errant, and what he then was; for it was only reasonable that, his master taking a new character, he should take a new name, and that it should be a distinguished and full-sounding one, befitting the new order and calling he was about to follow. And so, after having composed, struck out, rejected, added to, unmade, and remade a multitude of names out of his memory and fancy, he decided upon calling him Rocinante, a name, to his thinking, lofty, sonorous, and significant of his condition as a hack before he became what he now was, the first and foremost of all the hacks in the world.
Having got a name for his horse so much to his taste, he was anxious to get one for himself, and he was eight days more pondering over this point, till at last he made up his mind to call himself “Don Quixote,” whence, as has been already said, the authors of this veracious history have inferred that his name must have been beyond a doubt Quixada, and not Quesada as others would have it. Recollecting, however, that the valiant Amadis was not content to call himself curtly Amadis and nothing more, but added the name of his kingdom and country to make it famous, and called himself Amadis of Gaul, he, like a good knight, resolved to add on the name of his, and to style himself Don Quixote of La Mancha, whereby, he considered, he described accurately his origin and country, and did honour to it in taking his surname from it.
So then, his armour being furbished, his morion turned into a helmet, his hack christened, and he himself confirmed, he came to the conclusion that nothing more was needed now but to look out for a lady to be in love with; for a knight-errant without love was like a tree without leaves or fruit, or a body without a soul. As he said to himself, “If, for my sins, or by my good fortune, I come across some giant hereabouts, a common occurrence with knights-errant, and overthrow him in one onslaught, or cleave him asunder to the waist, or, in short, vanquish and subdue him, will it not be well to have some one I may send him to as a present, that he may come in and fall on his knees before my sweet lady, and in a humble, submissive voice say, ‘I am the giant Caraculiambro, lord of the island of Malindrania, vanquished in single combat by the never sufficiently extolled knight Don Quixote of La Mancha, who has commanded me to present myself before your Grace, that your Highness dispose of me at your pleasure’?” Oh, how our good gentleman enjoyed the delivery of this speech, especially when he had thought of some one to call his Lady! There was, so the story goes, in a village near his own a very good-looking farm-girl with whom he had been at one time in love, though, so far as is known, she never knew it nor gave a thought to the matter. Her name was Aldonza Lorenzo, and upon her he thought fit to confer the title of Lady of his Thoughts; and after some search for a name which should not be out of harmony with her own, and should suggest and indicate that of a princess and great lady, he decided upon calling her Dulcinea del Toboso—she being of El Toboso—a name, to his mind, musical, uncommon, and significant, like all those he had already bestowed upon himself and the things belonging to him.
-
Classic Literature #1: Romeo and Juliet
About the book
Author: William Shakespeare
Country: England
Genre: Shakespearean tragedy
Publication date: 1597
Synopsis
The prologue of Romeo and Juliet calls the title characters “star-crossed lovers”—and the stars do seem to conspire against these young lovers.
Romeo is a Montague, and Juliet a Capulet. Their families are enmeshed in a feud, but the moment they meet—when Romeo and his friends attend a party at Juliet’s house in disguise—the two fall in love and quickly decide that they want to be married.
A friar secretly marries them, hoping to end the feud. Romeo and his companions almost immediately encounter Juliet’s cousin Tybalt, who challenges Romeo. When Romeo refuses to fight, Romeo’s friend Mercutio accepts the challenge and is killed. Romeo then kills Tybalt and is banished. He spends that night with Juliet and then leaves for Mantua.
Juliet’s father forces her into a marriage with Count Paris. To avoid this marriage, Juliet takes a potion, given her by the friar, that makes her appear dead. The friar will send Romeo word to be at her family tomb when she awakes. The plan goes awry, and Romeo learns instead that she is dead. In the tomb, Romeo kills himself. Juliet wakes, sees his body, and commits suicide. Their deaths appear finally to end the feud.
-
My personal Online Library
What is Lorem Ipsum?
This is an example post ‘<’. Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry’s standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.
Why do we use it?
It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using ‘Content here, content here’, making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for ‘lorem ipsum’ will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).
Where does it come from?
Contrary to popular belief, Lorem Ipsum is not simply random text. It has roots in a piece of classical Latin literature from 45 BC, making it over 2000 years old. Richard McClintock, a Latin professor at Hampden-Sydney College in Virginia, looked up one of the more obscure Latin words, consectetur, from a Lorem Ipsum passage, and going through the cites of the word in classical literature, discovered the undoubtable source. Lorem Ipsum comes from sections 1.10.32 and 1.10.33 of “de Finibus Bonorum et Malorum” (The Extremes of Good and Evil) by Cicero, written in 45 BC. This book is a treatise on the theory of ethics, very popular during the Renaissance. The first line of Lorem Ipsum, “Lorem ipsum dolor sit amet..”, comes from a line in section 1.10.32.
The standard chunk of Lorem Ipsum used since the 1500s is reproduced below for those interested. Sections 1.10.32 and 1.10.33 from “de Finibus Bonorum et Malorum” by Cicero are also reproduced in their exact original form, accompanied by English versions from the 1914 translation by H. Rackham.
Where can I get some?
There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don’t look even slightly believable. If you are going to use a passage of Lorem Ipsum, you need to be sure there isn’t anything embarrassing hidden in the middle of text. All the Lorem Ipsum generators on the Internet tend to repeat predefined chunks as necessary, making this the first true generator on the Internet. It uses a dictionary of over 200 Latin words, combined with a handful of model sentence structures, to generate Lorem Ipsum which looks reasonable. The generated Lorem Ipsum is therefore always free from repetition, injected humour, or non-characteristic words etc.
-
-
-
Markdown from A to Z
Headings
To create a heading, add number signs (#) in front of a word or phrase. The number of number signs you use should correspond to the heading level. For example, to create a heading level three (<h3>), use three number signs (e.g., ### My Header).
Markdown
HTML
Rendered Output
# Header 1
<h1>Header 1</h1>
Header 1
## Header 2
<h2>Header 2</h2>
Header 2
### Header 3
<h3>Header 3</h3>
Header 3
Emphasis
You can add emphasis by making text bold or italic.
Bold
To bold text, add two asterisks (e.g., **text** = text) or underscores before and after a word or phrase. To bold the middle of a word for emphasis, add two asterisks without spaces around the letters.
Italic
To italicize text, add one asterisk (e.g., *text* = text) or underscore before and after a word or phrase. To italicize the middle of a word for emphasis, add one asterisk without spaces around the letters.
Blockquotes
To create a blockquote, add a > in front of a paragraph.
> Yongha Kim is the best developer in the world.
>
> Factos 👍👀
Yongha Kim is the best developer in the world.
Factos 👍👀
Lists
You can organize items into ordered and unordered lists.
Ordered Lists
To create an ordered list, add line items with numbers followed by periods. The numbers don’t have to be in numerical order, but the list should start with the number one.
1. First item
2. Second item
3. Third item
4. Fourth item
First item
Second item
Third item
Fourth item
Unordered Lists
To create an unordered list, add dashes (-), asterisks (*), or plus signs (+) in front of line items. Indent one or more items to create a nested list.
* First item
* Second item
* Third item
* Fourth item
First item
Second item
Third item
Fourth item
Code
To denote a word or phrase as code, enclose it in backticks (`).
Markdown
HTML
Rendered Output
At the command prompt, type `nano`.
At the command prompt, type <code>nano</code>.
At the command prompt, type nano.
Escaping Backticks
If the word or phrase you want to denote as code includes one or more backticks, you can escape it by enclosing the word or phrase in double backticks (``).
Markdown
HTML
Rendered Output
``Use `code` in your Markdown file.``
<code>Use `code` in your Markdown file.</code>
Use `code` in your Markdown file.
Code Blocks
To create code blocks that spans multiple lines of code, set the text inside three or more backquotes ( ``` ) or tildes ( ~~~ ).
<html>
<head>
</head>
</html>
def foo():
a = 1
for i in [1,2,3]:
a += i
Horizontal Rules
To create a horizontal rule, use three or more asterisks (***), dashes (---), or underscores (___) on a line by themselves.
***
---
_________________
Links
To create a link, enclose the link text in brackets (e.g., [Blue Archive]) and then follow it immediately with the URL in parentheses (e.g., (https://bluearchive.nexon.com)).
My favorite mobile game is [Blue Archive](https://bluearchive.nexon.com).
The rendered output looks like this:
My favorite mobile game is Blue Archive.
Adding Titles
You can optionally add a title for a link. This will appear as a tooltip when the user hovers over the link. To add a title, enclose it in quotation marks after the URL.
My favorite mobile game is [Blue Archive](https://bluearchive.nexon.com "All senseis are welcome!").
The rendered output looks like this:
My favorite mobile game is Blue Archive.
URLs and Email Addresses
To quickly turn a URL or email address into a link, enclose it in angle brackets.
<https://www.youtube.com/>
<fake@example.com>
The rendered output looks like this:
https://www.youtube.com/
fake@example.com
Images
To add an image, add an exclamation mark (!), followed by alt text in brackets, and the path or URL to the image asset in parentheses. You can optionally add a title in quotation marks after the path or URL.

The rendered output looks like this:
Linking Images
To add a link to an image, enclose the Markdown for the image in brackets, and then add the link in parentheses.
[](https://www.britannica.com/place/La-Mancha)
The rendered output looks like this:
Escaping Characters
To display a literal character that would otherwise be used to format text in a Markdown document, add a backslash (\) in front of the character.
\* Without the backslash, this would be a bullet in an unordered list.
The rendered output looks like this:
* Without the backslash, this would be a bullet in an unordered list.
Characters You Can Escape
You can use a backslash to escape the following characters.
Character
Name
`
backtick
*
asterisk
_
underscore
{}
curly braces
[]
brackets
<>
angle brackets
()
parentheses
#
pound sign
+
plus sign
-
minus sign (hyphen)
.
dot
!
exclamation mark
|
pipe
HTML
Many Markdown applications allow you to use HTML tags in Markdown-formatted text. This is helpful if you prefer certain HTML tags to Markdown syntax. For example, some people find it easier to use HTML tags for images. Using HTML is also helpful when you need to change the attributes of an element, like specifying the color of text or changing the width of an image.
To use HTML, place the tags in the text of your Markdown-formatted file.
This **word** is bold. This <span style="font-style: italic;">word</span> is italic.
The rendered output looks like this:
This word is bold. This word is italic.
None
· 2023-09-05
Touch background to close