Stability Analysis of Positive Linear Switched Systems: A Variational Approach