Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Objective We will be analyzing the error associated with our ultrasonic ranger today. It will not be used to track motion yet, since we need
Objective
We will be analyzing the error associated with our ultrasonic ranger today. It will not be used to track motion yet, since we need to have a sense first of how much error we should expect in its measurements that we take in the future. Data is only as good as the sensor that takes it In this lab you will plot real time data from the sensor and analyze it for its standard deviation and standard error.
Please provide answers in your lab submission for all the questions in the procedure below. They are indicated by Q Q etc. What you are to submit to Canvas is a pdf file that is produced as an output from a MATLAB live script. This is not an mfile, nor is it an output of the command window. In the live script you need to have all the code you used, all the outputted values for the statistics, and the plots of the acquired data. That way you are submitting a complete record of what you did. You are also to include nicely formatted, written responses in complete sentences to any questions in the lab. Naturally, put a title and your name at the top as you would on any submission you'd turn in by hand in person.
Please note that code blocks in MATLAB live scripts are not meant for English writing. There are text blocks for that purpose. Writing English sentences in code blocks tends to look like a mess with random purple text and sentences that run right off the page. Please don't do that.
If you write code that returns an error in the live script and don't clean it up but instead leave the error messages it will result in point deductions for formatting. The goal you should have in mind with your submission is that it has the same clean formatting you'd expect of a lab report turned in by hand.
Please note that MATLAB will output the live script as pdf directly, so you don't need any external software.
Make sure to include answers to the background questions on statistics along with your lab submission in the same live script
Procedure
At the bottom of this document is computer code that you can use in MATLAB to allow realtime data acquisition from the ultrasonic sensor It will plot the data and save it in an array in MATLAB for analysis.
Simply cut and paste all the code into a new code block in a live script. To create a life script in MATLAB, go to the top bar and choose NewLive script. Here is a link to MATLAB naming conventions: Naming conventions for when you assign a name to your live script.
Set up your sensor such that it faces a stationary object. It is best if they both are stable and on the same surface so that, for instance, error doesn't arise due to a table shaking on which the sensor sits, while the stationary object is on another unshaken surface. Whatever your stationary object is it should be stable and have a side that faces the sensor This is necessary since sound waves need to reflect back to the sensor and they will reflect just like balls or light rays bounce reflect off surfaces.
Use the icon that looks like a play button to start data acquisition. You should see a plot of data and it will acquire data for around seconds. Exactly how long it runs depends on your computer processor and graphics capabilities. Ultimately it will run until data points are gathered.
Notice that in the area of MATLAB called 'Workspace' there are now two arrays of data that we will use. They are called t and x x contains the distance measurements taken by the sensor and t contains the time stamps from when they were taken.
Use the length command and find out how many distance measurements were taken. Type lengthx to get this value. Q: What is the length of the array?
If nothing was moving, there was only one distance between the sensor yet the x values are not all the same. This is the nature of doing science. Error is inherent in measurements. In this case we measured one quantity the distance to that object many the length of the array times. Because of this, even though our sensor has error and therefore we couldn't expect a single measurement to be "right" we can take advantage of making multiple measurements and get a more precise value.
Find the mean value of the values in x This is done by typing meanx Q: What is your mean value in meters?
The standard deviation of the array values can be found using stdx Q What is your standard deviation. Note that the e is scientific notation. So e means
This e notation is both how you input scientific notation into computers, and how they output it to us It is however, NEVER appropriate to write it this way by hand! Note that some computer languages use a capital E MATLAB will accept either as input.
The standard error mentioned in the reading will need to be calculated next. Please find it for your x array. Note that the square root is found in MATLAB by using the sqrt command, an
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started