效果图:
演示代码:
\documentclass{article}
\usepackage{tikz,mathpazo} %图形绘制宏包
\usepackage{float} %浮动包
\usepackage{booktabs} %表格线条粗细控制
\usepackage{graphicx}%插入图片
\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[H]
\centering
\begin{tikzpicture}
%坐标轴
\draw[->,ultra thick](0,0)--(10,0) node[above]{\textbf{$t$}};
\draw[->,ultra thick](0,0)--(0,6) node[left]{\textbf{$u$}};
\draw (0,0) node[below=3.6pt]{$0$};
%x轴坐标
\draw (1.5,0) node[below=3.6pt]{$t_{1}$};
\draw (4,0) node[below=3.6pt]{$ t_{n}$};
\draw (6.5,0) node[below=3.6pt]{$t_{n+1}$};
\draw (9,0) node[below=3.6pt]{$T$};
%y轴坐标
\draw (0,0.5) node[left=3.6pt]{$u_{0}$};
\filldraw (0,0.5)circle(0.8ex);%黑点
%数值解的实线
\draw (1.5,0) --(1.5,3) node[left]{$u_{1}$};
\filldraw (1.5,3)circle(0.8ex);
\draw (4,0) --(4,4) node[above=3.6pt]{$u_{n}$};
\filldraw (4,4)circle(0.8ex);
\draw (6.5,0) --(6.5,4.5) node[above]{$u_{n+1}$};
\filldraw (6.5,4.5)circle(0.8ex);
\filldraw (9,4.5)circle(0.8ex);
%数值解的连线
\draw (0,0.5) --(1.5,3);
\draw (1.5,3) --(4,4);
\draw (4,4) --(6.5,4.5);
\draw (6.5,4.5) --(9,4.5)node[above]{};
%解析解的实线
\draw (4,0) --(4,2.8) node[right=3.6pt]{$u(t_{n})$};
\draw (4,2.8)circle(0.8ex);
\draw (6.5,0) --(6.5,3.5) node[below=3.6,right]{$u(t_{n+1})$};
\draw (6.5,3.5)circle(0.8ex);
%解析解的连线
\draw (0,0.5) --(4,2.8);
\draw (4,2.8) --(6.5,3.5);
\draw (6.5,3.5) --(9.5,3.6)node[above]{};
%t1和tn之间的点
\draw (1.5,0)--node[below=5pt]{.............}(4,0);
\draw (6.5,0)--node[below=5pt]{.............}(9,0);
%===============================================
\draw(6.5,-1)--(6.5,-1.5);
\draw(4,-1)--(4,-1.5);
\draw[<->,thick](4,-1.3)--(6.5,-1.3);
\draw (4,-1.3)--node[above]{$h$}(6.5,-1.3);
\end{tikzpicture}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\vspace{1.5cm}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\begin{figure}[H]
\centering
\begin{tikzpicture}
%坐标轴
\draw[->](-0.3,0)--(12,0) node[right]{$x$};
\draw[->](0,-0.3)--(0,7) node[right]{$t$};
%x轴坐标
\draw (2.5,0) node[below=3.6pt]{$x_{j-1}$};
\draw (6.5,0) node[below=3.6pt]{$x_{j}$};
\draw (10.5,0) node[below=3.6pt]{$x_{j+1}$};
\draw (4.208,3.5) node[above=7.2pt,right=0.9pt]{\textbf{P}};
%y轴坐标
\draw (0,3.5) node[left=3.6pt]{$t_{n}$};
\draw (0,6) node[left=3.6pt]{$t_{n+1}$};
%虚线
\draw[-,dashed] (1,0)--(7.5,7.09);
\draw[-,dashed] (11.5,0)--(5.592,7.09);
%实线
\draw [ultra thick] (2.5,0) --(2.5,7.3) ;
\draw [ultra thick](6.5,0) --(6.5,7.3);
\draw [ultra thick](10.5,0) --(10.5,7.3);
\draw[ultra thick](-0.3,6) --(11.5,6);%粗体线条
\draw[ultra thick](-0.3,3.5) --(11.5,3.5);
%黑点
\filldraw (2.5,0)circle(0.4ex);
\filldraw (6.5,0)circle(0.4ex);
\filldraw (10.5,0)circle(0.4ex);
\filldraw (2.5,3.5)circle(0.4ex);
\filldraw (2.5,6)circle(0.4ex);
\filldraw (6.5,3.5)circle(0.4ex);
\filldraw (6.5,6)circle(0.4ex);
\filldraw (10.5,3.5)circle(0.4ex);
\filldraw (10.5,6)circle(0.4ex);
\filldraw (4.208,3.5)circle(0.4ex);%交点P
%交点P左右箭头
\draw[<->,very thick](2.5,3.8)--(4.208,3.8);
\draw (2.5,3.8)--node[above=0.9pt]{$\delta x-c\delta t$ }(4.208,3.8);
\draw[<->,very thick](4.208,3.2)--(6.5,3.2);
\draw (4.208,3.2)--node[below=0.9pt]{$c\delta t$ }(6.5,3.2);
%标注直线方程
\draw (3,2.3)node[right=3.6pt]{$(c>0)$};
\draw (10,2.3)node[left=10.8pt]{$(c<0)$};
\end{tikzpicture}
\end{figure}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\end{document}