Exp. points

Can someone please explain how experience point are calculated???

Everything is based on lvl troops/towers of the player opponent: here a video also that shows how aprroximately is calculated  by Flothabosss