Calculate the velocity of objects with ultrasonic sensors.

I was trying to calculate multiple objects that were coming from 8 different directions using 8 ultra sonic sensors. I have manage to create a program that can store the speeds of the objects in an array 5x5, and replace the previous values when it is possible. However, I have no idea what should I do to calculate the velocity using this array, please help!

Sorry, but I don't understand the problem.

What "velocity" do you want to calculate?

What does a 5x5 array of speeds have to do with 8 directions?

For velocity, you need to have determined the direction of travel.

Paul

What I am trying to do is record down 5 instance of the object's distance, and use it to calculate the average velocity. But I have no idea how to find the time difference.

I have no idea how to find the time difference.

Use the millis() timer to record when each measurement was made, and subtract to get the time difference.

You can do it like this, firstly calculate the time by using millis() or run a loop for particular interval. let's say for 4 sec. now calculate the change in distance during that interval. you can take this value and store it in an array. calculate the distance covered during this interval. and calculate the velocity.