Competitive Learning In Rate Coded And Spiking Neural Networks Models With Applications To Vision And Audition