Question

In: Computer Science

USING MATLAB: Using the data from table below fit a fourth-order polynomial to the data, but...

USING MATLAB:

Using the data from table below fit a fourth-order polynomial to the data, but use a label for the year starting at 1 instead of 1872. Plot the data and the fourth-order polynomial estimate you found, with appropriate labels. What values of coefficients did your program find? What is the LMS loss function value for your model on the data?

Year Built SalePrice
1885 122500
1890 240000
1900 150000
1910 125500
1912 159900
1915 149500
1920 100000
1921 140000
1922 140750
1923 109500
1925 87000
1928 105900
1929 130000
1930 138400
1936 123900
1938 119000
1939 134000
1940 119000
1940 244400
1942 132000
1945 80000
1948 129000
1950 128500
1951 141000
1957 149700
1958 172000
1959 128950
1960 215000
1961 105000
1962 84900
1963 143000
1964 180500
1966 142250
1967 178900
1968 193000
1970 149000
1971 149900
1972 197500
1974 170000
1975 120000
1976 130500
1977 190000
1978 206000
1980 155000
1985 212000
1988 164000
1990 171500
1992 191500
1993 175900
1994 325000
1995 236500
1996 260400
1997 189900
1998 221000
1999 333168
2000 216000
2001 222500
2002 320000
2003 538000
2004 192000
2005 220000
2006 205000
2007 306000
2008 262500
2009 376162
2010 394432

Solutions

Expert Solution

`Hey,

Note: Brother if you have any queries related the answer please do comment. I would be very happy to resolve all your queries.

clear all
clc
M=load('aa.txt');
n=size(M,1);
x=[13, 18, 28, 38, 40, 43, 48, 49, 50, 51, 53, 56, 57, 58, 64, 66, 67, 68, 68, 70, 73, 76, 78, 79, 85, 86, 87, 88, 89, 90, 91, 92, 94, 95, 96, 98, 99, 100, 102, 103, 104, 105, 106, 108, 113, 116, 118, 120, 121, 122, 123, 124, 125, 126, 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138]+1;
y=[122500, 240000, 150000, 125500, 159900, 149500, 100000, 140000, 140750, 109500, 87000, 105900, 130000, 138400, 123900, 119000, 134000, 119000, 244400, 132000, 80000, 129000, 128500, 141000, 149700, 172000, 128950, 215000, 105000, 84900, 143000, 180500, 142250, 178900, 193000, 149000, 149900, 197500, 170000, 120000, 130500, 190000, 206000, 155000, 212000, 164000, 171500, 191500, 175900, 325000, 236500, 260400, 189900, 221000, 333168, 216000, 222500, 320000, 538000, 192000, 220000, 205000, 306000, 262500, 376162, 394432];
C=polyfit(x,y,4);
disp('Coefficients of 4th order polynomial with 1872 as year 1');
disp(C);
xx=1:1:140;
yy=polyval(C,xx);
plot(x,y,'o',xx,yy);
xlabel('Year starting 1872 as 1');
ylabel('Sale Price');
disp('LMS is');
sum((y-polyval(C,x)).^2)

Kindly revert for any queries

Thanks.


Related Solutions

Using matlab a) Find the transfer function of a fourth order Butterworth filter and plot the...
Using matlab a) Find the transfer function of a fourth order Butterworth filter and plot the magnitude response. b) Find the poles.
Design a cam for a rise-return-dwell (RRD) application using the fourth order polynomial. The position, velocity,...
Design a cam for a rise-return-dwell (RRD) application using the fourth order polynomial. The position, velocity, and acceleration should be zero at the beginning of the rise h, and the velocity should be zero at the end of the rise. Plot s, v, a, and j profiles for BOTH fourth and fifth order polynomials using EXCEL. (Note: this is to all be done by hand in regards to the fourth and fifth order polynomial. Only Excel can be used for...
Using the data in the table below, calculate the return for investing in the share from...
Using the data in the table below, calculate the return for investing in the share from 1 January to 31 December. Prices are after the dividend has been paid Date Price Dividend     Jan 1 $31.53 − Feb 5 $31.11 $0.22 May 14 $30.67 $0.18 Aug 13 $31.78 $0.21 Nov 12 $37.95 $0.22 Dec 31 $40.11 Return for the entire period is ................. ​%. ​(Enter your response as a percent rounded to two decimal​ places.)
The table below summarizes data from a survey of a sample of women. Using a 0.05...
The table below summarizes data from a survey of a sample of women. Using a 0.05 significance​ level, and assuming that the sample sizes of 900 men and 400 women are​ predetermined, test the claim that the proportions of​ agree/disagree responses are the same for subjects interviewed by men and the subjects interviewed by women. Does it appear that the gender of the interviewer affected the responses of​ women? Gender of Interviewer Man Woman Women who agree 619 314 Women...
The table below summarizes data from a survey of a sample of women. Using a 0.01...
The table below summarizes data from a survey of a sample of women. Using a 0.01 significance​ level, and assuming that the sample sizes of 900men and 300 women are​ predetermined, test the claim that the proportions of​ agree/disagree responses are the same for subjects interviewed by men and the subjects interviewed by women. Does it appear that the gender of the interviewer affected the responses of​ women? Man Woman Women who agree 617 235 Women who disagree 283 65...
The table below summarizes data from a survey of a sample of women. Using a 0.050.05...
The table below summarizes data from a survey of a sample of women. Using a 0.050.05 significance​ level, and assuming that the sample sizes of 800800 men and 300300 women are​ predetermined, test the claim that the proportions of​ agree/disagree responses are the same for subjects interviewed by men and the subjects interviewed by women. Does it appear that the gender of the interviewer affected the responses of​ women? Gender of Interviewer Man Woman Women who agree 517517 262262 Women...
The table below summarizes data from a survey of a sample of women. Using a 0.05...
The table below summarizes data from a survey of a sample of women. Using a 0.05 significance​ level, and assuming that the sample sizes of 700 men and 300 women are​ predetermined, test the claim that the proportions of​ agree/disagree responses are the same for subjects interviewed by men and the subjects interviewed by women. Does it appear that the gender of the interview affected the responses of​ women? Man Woman Woman who agree 481 245 Woman who disagree 219...
The table below summarizes data from a survey of a sample of women. Using a 0.05...
The table below summarizes data from a survey of a sample of women. Using a 0.05 significance​ level, and assuming that the sample sizes of 900 men and 400 women are​ predetermined, test the claim that the proportions of​ agree/disagree responses are the same for subjects interviewed by men and the subjects interviewed by women. Does it appear that the gender of the interviewer affected the responses of​ women?    Man   Woman Women who agree   605   322 Women who disagree  ...
The table below summarizes data from a survey of a sample of women. Using a 0.010.01...
The table below summarizes data from a survey of a sample of women. Using a 0.010.01 significance​ level, and assuming that the sample sizes of 800800 men and 400400 women are​ predetermined, test the claim that the proportions of​ agree/disagree responses are the same for subjects interviewed by men and the subjects interviewed by women. Does it appear that the gender of the interviewer affected the responses of​ women? Gender of Interviewer Man Woman Women who agree 489489 329329 Women...
Plot the original data and the regression “line” ************USING Matlab************. "Submit plot" USING MATLAB! USING MATLAB!...
Plot the original data and the regression “line” ************USING Matlab************. "Submit plot" USING MATLAB! USING MATLAB! USING MATLAB! ONLY BY USING MATLAB!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 14.9 The concentration of E. coli bacteria in a swimming area is monitored after a storm: t (hr)                     4           8         12        16    20 24 c (CFU/100 mL) 1600     1320   1000     890 650 560 The time is measured in hours following the end of the storm and the unit CFU is a .colony forming unit.. Use this data to estimate (a)...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT