Question: please give me a code that completes the assessment below thank you you Mechanical Spring Deflection Some tests are run where a ball of a

please give me a code that completes the assessment below thank you you
Mechanical Spring Deflection
Some tests are run where a ball of a fixed mass dropped from a known height to land inelastically onto a spring whose maximum compression is recorded. The data collected from tests runs at several heights will be contained in a text file (in the same folder as your Matlab code) called CompressionVersusHeight.txt, an example of which is available on CatCourses. Note that the data file can have any number of data points after the three header lines and any script that reads it must be able to read different versions without change to the script. A plot of the example data is shown.
Write a single-file Matlab script that reads the data from CompressionVersusHeight. txt. Then, use Matlab's curve-fitting function to find a curve of the form \( y=A \sqrt{x}\) that best fits the data. Make sure that your code assigns the value of the value of Ato a variable called A. On a single figure, plot the original data with markers and the fitted curve on the same plot, with a legend, appropriate axis labels and indicate clearly in the plot title the value obtained for \( A \), with four digits after the decimal place.
Hint: This is most easily done using the custom curve fit technique discussed in the lecture notes.
A sample of the resulting plot for a slightly different data set is shown below.
Write a single-file Matlab script that reads the data from CompressionVersusHeight. txt. Then, use Matlab's curve-fitting function to
find a curve of the form y=Asqrtx that best fits the data. Make sure that your code assigns the value of the value of Ato a variable called
A. On a single figure, plot the original data with markers and the fitted curve on the same plot, with a legend, appropriate axis labels and
indicate clearly in the plot title the value obtained for A, with four digits after the decimal place.
Hint: This is most easily done using the custom curve fit technique discussed in the lecture notes.
A sample of the resulting plot for a slightly different data set is shown below.
Data with x=A** sqrt(h) curve fit
A=0.9836
reads data
Error using fit>iFit (line 233) X, Y and WEIGHTS cannot have NaN values. Error in fit (line 117)[fitobj, goodness, output,
convmsg]= iFit( xdatain, ydatain, fittypeobj, ... Error in solution (line 9) fitResult = fit(h, x, model, 'StartPoint', startPoint); %
Fit the data using the model
Data must be read from 'CompressionVersusHeight.txt'
Feedback is shown for the initial error only, as subsequent failures may be due to the first error Show Feedback
check coefficient
check plot title
check plot legend
please give me a code that completes the

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 Programming Questions!