- #1
ndnbolla
- 19
- 0
Matlab and Root Mean Square help please...
So I have this given data:
year = [1928:4:1936 1948:4:1956 1964:4:2000];
time = [12.2 11.9 11.5 11.9 11.5 11.5 11.4 11.08 11.07 11.08 11.06 10.97 10.54 10.82 10.94 10.75];
and after plotting it (time vs. year), I am told to find the best first order least squares fit to the data by a line using the polyfit function.
I am then told to find the root mean square error in this line and then plotting that best line?
How would I go about doing this?
When I did this, I used the function Fit1=polyfit(year, time, 1);
Fit1 came out to equal -0.0185 47.6837 which, when plotted on the same graph as the original data resembled nothing like it.
What am I doing wrong?
So I have this given data:
year = [1928:4:1936 1948:4:1956 1964:4:2000];
time = [12.2 11.9 11.5 11.9 11.5 11.5 11.4 11.08 11.07 11.08 11.06 10.97 10.54 10.82 10.94 10.75];
and after plotting it (time vs. year), I am told to find the best first order least squares fit to the data by a line using the polyfit function.
I am then told to find the root mean square error in this line and then plotting that best line?
How would I go about doing this?
When I did this, I used the function Fit1=polyfit(year, time, 1);
Fit1 came out to equal -0.0185 47.6837 which, when plotted on the same graph as the original data resembled nothing like it.
What am I doing wrong?