An analytical approach for calculating natural frequencies of finite one-dimensional acoustic metamaterials