Linear Regressions Data Worksheet

Description

Hi, I have a Matlab data handling exercise that i really need done urgently (in 2 hours or under), it should not take more than 1 hour. The assignment involves calculating calibration data and making linear regressions. Please send me back the entire code used to calculate everything and the plots, I will pay whatever is necessary! Attached are the instructions and the submission sheet.

1 attachmentsSlide 1 of 1attachment_1attachment_1

Unformatted Attachment Preview

E80 Matlab Assignment 3
Importing Data & Data Types
For this assignment, you will learn about a little bit about the most common types of Matlab
variables, then get more practice with regression and plotting. Finally, you will save your data as
two types of files (.mat and .txt).
Figure 1: Deploying the Iver2 AUV in Arctic seas.
Introduction
During the winter of 2006, Dr. Clark and 18 biologists flew to the remote field station named NyAlesund in the Arctic. The expedition took place in early January, during the polar night when the
researchers were subject to 24 hours of darkness. The goal of the expedition was to assess the
impact of the polar night on the underwater ecosystem using robots for sampling a large number
of variables.
The team brought 5 different underwater robots, one of which was Clark’s Iver2 AUV. Concerned
about the effect of the cold temperatures on battery duration, an experiment was set up at the
field station in which Arctic sea water was continuously pumped into and out of a water tank.
The Iver2 AUV was held submerged in the tank, with the prop motor running continuously at
100% for over 10 hours. The battery capacity (%) was logged throughout the experiment and
the data will be used for this Matlab assignment 3.
File Download
1. To complete the remainder of the assignment, you will need one file named
coldTankFullmission1.log that can be found here. Please download the file and put them
somewhere accessible to Matlab, (e.g. in the MATLAB directory often found under the
Documents directory in the file structure).
Data Investigation
1. Load the data from the file named coldTankFullmission1.log using the load function. For
example:
fileData = load(‘coldtankFullmission1.log’,’-ascii’);
2. Create a vector named batteryCapacity by extracting the first column of matrix fileData:
batteryCapacity = fileData(:,1);
Make sure you understand the difference between extracting a row versus a column
from a matrix.
3. Use the size() function to determine the dimensions of the batteryCapacity vector.
4. Create a timeSequenceInSeconds vector that starts at 0 and increments in 0.5 second
intervals. The vector should have the same dimensions as batteryCapacity.
5. Create a timeSequenceInHours vector by converting timeSequenceInSeconds to hours.
6. Plot the batteryCapacity vector as a function of timeSequenceInHours.
7. Add a label to the x and y axis (i.e. using the xlabel and ylabel functions). Be sure to
include units.
8. Observe your plot. Is the battery capacity decrease over time a linear, quadratic, or
exponential function?
9. Save the plot as a jpg, and add it to your submission sheet for this assignment.
Calibration
10. Use the polyfit to construct a linear model of the battery capacity as a function of time.
Store the slope and intercept values in a vector named P.
P = polyfit(timeSequenceInHours,batteryCapacity,1);
11. Add the value 10 to the intercept of the linear model so that the line crosses the y-axis at
approximately 100 %.
12. On a new Figure, plot the linear model from step 10. and step 11. Add a label to the x and
y axis (i.e. using the xlabel and ylabel functions). Be sure to include units. Also add a title
to the plot, e.g. ‘Iver2 Battery Capacity for Near Freezing Water Conditions’.
13. Save the plot as a jpg, and add it to your submission sheet for this assignment.
Calibration Errors
14. Use Matlab to calculate the confidence intervals 0 and 1 associated with the slope
and intercepts of the linear model calibration. Assume that the confidence intervals
bound the actual values with 99.9% confidence, (i.e. use the 0.001 column on the t
table). Lecture 2 contains equations that may be useful. Add these confidence limits to
the assignment 3 submission sheet.
Error Propagation
15. Use Matlab to calculate the battery capacity, when it is initially measured to be 53%, and
it is run for exactly four hours. That is, use the slope of the calibration to determine the
change in battery capacity over four hours, and add this change to 53%.
Using the propagation of errors equations (with quadrature), calculate the error
associated with the battery capacity calculation in the step 15. Write this error on the
submission sheet.
You can assume the error in the slope of the line is equal to the confidence interval 1.
Also, assume the error in the initial battery capacity (53%) is 1%.
Saving The Data – Part 1
16. Use the save function to save the variables batteryCapacity, timeSequenceInHours, and P
in a .mat file named batteryData.mat.
17. Clear all variables from Matlab’s workspace using the clear function.
18. Type who and confirm there are no variables left in the workspace.
Strings and Numbers
19. There are many data types in Matlab, but you don’t have to declare a data type (unlike
most programming languages) when you create a new variable. For example, the
following command will create a variable named newFloat with a value of 7.65.
newFloat = 7.65;
20. In the above example, the variable newFloat is of floating point type. Type the following
commands, one at a time, to confirm this:
isinteger(newFloat)
isfloat(newFloat)
isstr(newFloat)
21. Repeat this exercise with a variable named newString.
newString = ‘Hello’;
isinteger(newString)
isfloat(newString)
isstr(newString)
22. It is also possible to convert between data types. E.g.
anotherNewString = ’42.5’
anotherNewFloat = str2num(anotherNewString)
Note: An introduction to these data types can be found here.
Saving The Data – Part 2
23. Use the load function to load batteryData.mat.
24. Create a string named fileName, and set it equal to outputFile.txt
25. Use the fopen function to open fileName for writing to. You may need to research how
fopen works.
fid = fopen(fileName, ‘w’)
26. Use the fprintf function to write two columns of data (i.e. timeSequenceInHours and
batteryCapacity) to fileName. For example:
fprintf(fid, ‘%d %dn’, [timeSequenceInHours’; batteryCapacity’])
Read up on fprintf if you don’t know how to use it.
27. Use the function fclose to close the file for writing. You can double check all the data is
there by opening up the file in a notepad or at the Matlab prompt typing:
type outputFile.txt
28. Submit the file batteryData.txt with your submission sheet on Sakai.

Purchase answer to see full
attachment

Explanation & Answer:
4 pages

Tags:
data

matlab

linear regressions

User generated content is uploaded by users for the purposes of learning and should be used following Studypool’s honor code & terms of service.

Reviews, comments, and love from our customers and community:

Article Writing

Keep doing what you do, I am really impressed by the work done.

Alexender

Researcher

PowerPoint Presentation

I am speechless…WoW! Thank you so much!

Stacy V.

Part-time student

Dissertation & Thesis

This was a very well-written paper. Great work fast.

M.H.H. Tony

Student

Annotated Bibliography

I love working with this company. You always go above and beyond and exceed my expectations every time.

Francisca N.

Student

Book Report / Review

I received my order wayyyyyyy sooner than I expected. Couldn’t ask for more.

Mary J.

Student

Essay (Any Type)

On time, perfect paper

Prof. Kate (Ph.D)

Student

Case Study

Awesome! Great papers, and early!

Kaylin Green

Student

Proofreading & Editing

Thank you Dr. Rebecca for editing my essays! She completed my task literally in 3 hours. For sure will work with her again, she is great and follows all instructions

Rebecca L.

Researcher

Critical Thinking / Review

Extremely thorough summary, understanding and examples found for social science readings, with edits made as needed and on time. Transparent

Arnold W.

Customer

Coursework

Perfect!

Joshua W.

Student

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>