Question
could you solve this by using matlab?
1.0 1.4 2.2 3.0 3.9 5.2 0.1 9.9 13.5 Create a function that calculates the coefficients of the least-squares regression for a
0 0
Add a comment Improve this question Transcribed image text
Answer #1

`Hey,

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

clc
clear all
close all
format long
x=-10:10;
y=[11,85,60,44,40,27,16,10,0,2,2,1,7,8,15,20,33,50,58,81,104];
A=[x(:).^2 x(:) ones(numel(x),1)];
b=y(:);
[L,U,P]=lu(A);
z=L\b;
C=U\z;
a0=C(3)
a1=C(2)
a2=C(1)
r=sum((y-polyval(C,x)).^2)/sum((y-mean(y)).^2)
xx=-10:0.01:10;
yy=polyval(C,xx);
plot(xx,yy,x,y,'o');

MATLAB R2018a Figure 1 X Search Documentation Pradeep APPS EDITOR НOME PLOTS fx File Edit View Insert Iools Desktop Window He

Kindly revert for any queries

Thanks.

Add a comment
Know the answer?
Add Answer to:
could you solve this by using matlab? 1.0 1.4 2.2 3.0 3.9 5.2 0.1 9.9 13.5...
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
  • use matlab 6. You have a x-y relationship as follows 1 2 3 4 5 6 7 8 10 X 17.52 22.76 24.22 36.83 37.65 51.32 68.3...

    use matlab 6. You have a x-y relationship as follows 1 2 3 4 5 6 7 8 10 X 17.52 22.76 24.22 36.83 37.65 51.32 68.35 74.59 4.382 1.787 7.757 3nd order polynomial to curve-fit this relationship, i.e. We want to use a yaaxax +a^x (8) (a) Determine the coefficients of the polynomial by solving the following equation a (9) y's az a, (b) Determine the coefficients of the polynomial by using function polyfit (c) Make a plot showing...

  • a. As discussed in class, a coefficient matrix Z constructed with basis functions can be used...

    a. As discussed in class, a coefficient matrix Z constructed with basis functions can be used to solve for the unknown coefficients a; of a polynomial function. Use this technique to determine the coefficients do and a; for a linear fit (y = ao tax) to the following data: x 0 1 2 3 y 2.43 9.62 13.55 20.12 Hint: Use basis functions 1 and x to create your coefficient matrix Z. Solve for the vector a using the equation:...

  • solve it 26. [M] Example 3 in Section 4.8 displayed a low-pass linear filter that changed...

    solve it 26. [M] Example 3 in Section 4.8 displayed a low-pass linear filter that changed a signal y) into y+) and changed higher-frequency signal winto the zero signal, where y cos (Tk/4) and wcos(3 k/4). The following cal- culations will design a filter with approximately those prop- erties. The filter equation is a ao y&+2+ay+1+ azyk= Zk for all k Because the signals are periodic, with period 8, it suffices to study equation (8) for k 0..7. The action...

  • Could someone please give me some guidance on how to answer these, it's like looking at another language. Thank you...

    Could someone please give me some guidance on how to answer these, it's like looking at another language. Thank you in advance (a) Use the built regression tool in Excel and your personalized data set (see above) to estimate the simple regression of sales revenue in dollars (Y) generated by a salesperson in his/her first year of completed service on the salesperson’s aptitude test score (X). (2 marks) When answering the following questions, assume all the assumptions of the neoclassical...

  • Case: A small convenience store chain is interested in modeling the weekly sales of a store,...

    Case: A small convenience store chain is interested in modeling the weekly sales of a store, y, as a function of the weekly traffic flow on the street where the store is located. The table below contains data collected from 24 stores in the chain. Store Weekly Traffic Flow (thousands of cars) Weekly Sales ($ thousands) 1 59.3 6.3 2 60.3 6.6 3 82.1 7.6 4 32.3 3.0 5 98 9.5 6 54.1 5.9 7 54.4 6.1 8 51.3 5.0...

  • Can you please answers these four questions as aoin as possible please and thank you! Given...

    Can you please answers these four questions as aoin as possible please and thank you! Given are five observations for two variables, z and y 5 13 20 18 48 57 11 27 a. Choose the corre rect scatter diagram for these data: A. B. 60+ 60 50 50 40 40 30+ 30 20 20 10 10- 10 20 30 40 50 60 x 10 20 30 40 50 60 57 x y 60 60 50+ 50- 40- 40+ 30-...

  • For this exercise we will run a regression using Swiss demographic data from around 1888. The...

    For this exercise we will run a regression using Swiss demographic data from around 1888. The sample is a cross-section of French speaking counties in Switzerland This data come with the R package datasets. The first step is to load the package into your current environment by typing the command libraryldatasets) in to the R console. This loads a number of datasets including one called swiss. Type help/swiss) in the console for additional details. The basic variable definitions are as...

  • Consider the following data table: 0 2i = 0.2 0.4 f(xi) = 2 2.018 2.104 2.306...

    Consider the following data table: 0 2i = 0.2 0.4 f(xi) = 2 2.018 2.104 2.306 0.6 0.2 and 23=0.4 is The linear Lagrange interpolator L1,1 (2) used to linearly interpolate between data points 12 (Chop after 2 decimal places) None of the above. -2.50x+0.20 -5.00x+2.00 -5.00x+2.00 5.00x-1.00 Consider the following data table: 2 Ti = 0 0.2 0.4 0.6 f(x) = 2.018 2.104 2.306 0.2 and 23 = 0.4, the value obtained at 2=0.3 is Using Lagrange linear interpolation...

  • gold ($/oz) Y copper (cents/lb) X1 silver ($/oz) X2 Aluminum (cents/lb) X3 161.1 64.2 4.4 39.8...

    gold ($/oz) Y copper (cents/lb) X1 silver ($/oz) X2 Aluminum (cents/lb) X3 161.1 64.2 4.4 39.8 308 93.3 11.1 61 613 101.3 20.6 71.6 460 84.2 10.5 76 376 72.8 8 76 424 76.5 11.4 77.8 361 66.8 8.1 81 318 67 6.1 81 368 66.1 5.5 81 448 82.5 7 72.3 438 120.5 6.5 110.1 382.6 130.9 5.5 87.8 Statistics 11 Homework 9 Due Wednesday, Nov. 20 Metals.jmp lists the yearly average price of gold, copper, silver, and aluminum....

  • Help with 10-13 please? Thank you! 542 County Population (X) Elevation (X) Longitude (X) Obama% (Y)...

    Help with 10-13 please? Thank you! 542 County Population (X) Elevation (X) Longitude (X) Obama% (Y) Prediction Squared Error Broomfield 57 5269 105.1 51.7 44.46 52.56 Gilpin 9141 105.5 56.7 49.44 52.65 Denver 620 5245 104.9 73.5 73.86 0.13 Lake 11580 106.3 60.4 55.50 24.01 San Juan 1 10791 107.7 52.6 56.49 15.15 Clear Creek 9 9676 105.7 51.01 10.18 Ouray 10236 1078 51.5 55.85 18.89 Sedgwick 3802 102.4 31.3 33.63 5.43 Teller 9150 1052 32.1 49.83 314.32 Summit 28...

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
ADVERTISEMENT