The gps device has accuracy up to 5 meters. How to calculate speed from the GPS readings. I have latitude, longitude, altitude and data is sampled at 20Hz.
1. Just interpolate the dirty derivative. You can smooth out noise in the GPS position by using different forms of interpolation and interpolation kernels with longer support.
2. Use the EKF (or your favorite). You could use, say, a constant velocity model, with position and velocity being the states, and use the GPS readings as measurements. Then the velocity state of the EKF is what you want, and you can compute it at any time. Your process and measurement covariances can then be tuned to get a smoother answer (introducing delay, but removing some noise from the raw GPS position). You could also use, say, a fixed-lag Kalman smoother if you are okay with a little bit of delay. Obviously, if you know more about the dynamics of your system you could put that in instead of a constant velocity model.
The solution that I am suggesting to you is related with research topics and maybe it falls out of the scope of what you need the velocity for but, indeed, the proposed solution will help you to determine your velocity from GPS data, which is what you are requesting.
Please, let me draw your attention to the following publication:
EVA: GPS-based extended velocity and acceleration determination, Journal of Geodesy 85(6):329-340 · June 2011 (that you can download from ResearchGate)
This method provides you with, not only your velocity, but also your acceleration by means of carrier phase observables from L1. A network of stations is also needed.