https://jp.mathworks.com/help/econ/hfilter.html
hfilter - Hamilton filter for trend and cyclical components - MATLAB
The hfilter function applies the Hamilton filter to separate one or more time series into additive trend and cyclical components.
hamilton filtertrendcyclicalcomponentsmatlab