Latex-算法伪代码 - 严二姨的文章 - 知乎
https://zhuanlan.zhihu.com/p/266241159
写作开头导入相应的包:
\usepackage{algorithm}
\usepackage{algorithmicx}
\usepackage{algpseudocode} % 如果不想在算法伪代码模块中显示 end for 和 end while,则使用 %\usepackage[noend]{algpseudocode}
对应伪代码部分进行写作:
\begin{algorithm}
%\textsl{}\setstretch{1.8}
\renewcommand{\algorithmicrequire}{\textbf{Input:}} %将require转化为Input
\renewcommand{\algorithmicensure}{\textbf{Output:}} %将ensure转化为Output
\caption{STVMD based on STFT}
\label{alg1}
\begin{algorithmic}[1]
\STATE Initialization:$\left\{ {s_{k,t}^1} \right\},\left\{ {\omega _{k,t}^1} \right\},\lambda _t^1,n \leftarrow 0$
\STATE ${s_{r,t}}\left( \omega \right) = \int_0^{ + \infty } {
{s_r}\left( \tau \right){w_h}\left( {t - \tau } \right)} \exp \left( {j\omega \tau } \right)d\tau $