Question: A robot uses a laser sensor to detect the distance of obstacles. The laser has noise that produces two readings that are too big and

A robot uses a laser sensor to detect the distance of obstacles. The laser has noise that produces two readings that are too big and three readings that are too small. Write a matlab function, called avg_dist, to find the average distance reading after dropping the two largest values and the three smallest values. The function has one input parameter, the list of distances. The function has one output, the average distance after dropping the appropriate values.

Test Case: D = [33 33 6 38 32 4 37 31 37 38 60 9 67 33 37] avg_dist(D) % Should return 34.9

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!