A magnitude 4.0 earthquake has struck the Los Angeles coast just days after a seismic swarm hit the area.