Question
can someone please help wtih this curve fitting in mathlab
2. Curve Fitting Some tests are run with a ball of a fixed mass dropped from a known height onto a spring that is compressed
Compression versus Drop Height Data sample height compression (meters) (meters) 0.1000 0.4874 0.1826 0.5976 0.2652 0.7203 0.3
2. Curve Fitting Some tests are run with a ball of a fixed mass dropped from a known height onto a spring that is compressed a measured amount. The data collected from several test runs is contained in a text file CompressionVersusHeight.txt which is available on CatCourses. Note that the data file can have any number of data points and any script that reads it should allow for that. A plot of that data is shown. Spring Compression from Dropped Ball Write a Matlab script that reads the data from the given file Then, use Matlab's curve-fitting function to find a curve of the form y Avk that best fits the data. Plot the original data and the fitted curve on the same plot, with appropriate labels and indicate somewhere on the plot the value obtained for A. A sample of such a plot for a slightly different data set is shown below 0 02 04 06 0812 14 16 182 height (m) Data with x = A*sqrt(h) curve fit A- 0.9836 14 1.2 0.8 06 0.4 0.2 0 02 04 0. 0.8 1 12 4 18 2
Compression versus Drop Height Data sample height compression (meters) (meters) 0.1000 0.4874 0.1826 0.5976 0.2652 0.7203 0.3478 0.8099 0.4304 0.9590 0.5130 0.9902 0.5957 1.0422 0.6783 1.1816 0.7609 1.2108 0.8435 1.2606 0.9261 1.3383 1.0087 1.3664 1.0913 1.4265 1.1739 1.5618 1.2565 1.6157 1.3391 1.6284 1.4217 1.6261 1.5043 1.6915 1.5870 1.7499 1.6696 1.8420 1.7522 1.8057 1.8348 1.8516 1.9174 1.9065 2.0000 1.9958 4 10 12 13 14 15 16 17 18 19 20 21 23 24
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

Note: Brother in case of any queries, just comment in box I would be very happy to assist all your queries

clc%clears the screen
clear all %clears the history
format long
%M=rand(100,2)*10;
M=load('CompressionVersusHeight.txt');
x=M(:,1);
y=M(:,2);
C=[sqrt(x)];
b=y;
A=C\b;
s=sprintf('Data with x=A*sqrt(h) curve fit\nA=%.4f',A);
xx=linspace(min(x),max(x),100);
plot(x,y,'*g',xx,A*sqrt(xx));
title(s);
legend('Data','Fit');
xlabel('height (m)');
ylabel('Compression (m)');

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
can someone please help wtih this curve fitting in mathlab 2. Curve Fitting Some tests are run with a ball of a fixed mass dropped from a known height onto a spring that is compressed a measured...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT