Calculation of electron-energy-loss spectra of composites and self-similar structures