Objective #1: Implement a function in Matlab that finds that parameters, b_hat, of a polynomial regression model. Begin from 'regress_fit_poly.m', which is a stub (i.e., unfinished) version of the function provided for you. The inputs and outputs of your function should conform to the following specifications: % Inputs: % x - A n-by-1 vector of feature values % (where n is number of data points) % y - A n-by-1 vector of response variable values % p - A scalar value, indicating the polynomial order % Outputs: % b_hat - a p+1-by-1 vector of regression coefficients Note: Your function should be able to calculate the polynomial regression parameters for a model of any order (i.e., an input ‘p’ of any value). Note: To see if your function is working correctly, you can check the outputs of your function against those produced by Matlab's 'polyfit' function. However, you should not call ‘polyfit’ inside your own function. Note: Pay special attention to the order of the parameters, which is important, and which may be different than you expect. If you notice that the parameters coming from your function differ from those of 'polyfit', think hard about how you might rearrange them to match. You have several options. For instance, you could change the ordering of columns in the design matrix. Alternatively, you could look into the Matlab functions 'fliplr' and 'flipud', which might help.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Objective #1:
Implement a function in Matlab that finds that parameters, b_hat, of a polynomial regression model.
Begin from 'regress_fit_poly.m', which is a stub (i.e., unfinished) version of the function provided for
you. The inputs and outputs of your function should conform to the following specifications:


% Inputs:
% x - A n-by-1 vector of feature values
% (where n is number of data points)
% y - A n-by-1 vector of response variable values
% p - A scalar value, indicating the polynomial order

% Outputs:
% b_hat - a p+1-by-1 vector of regression coefficients


Note: Your function should be able to calculate the polynomial regression parameters for a model of any
order (i.e., an input ‘p’ of any value).


Note: To see if your function is working correctly, you can check the outputs of your function against
those produced by Matlab's 'polyfit' function. However, you should not call ‘polyfit’ inside your own
function.


Note: Pay special attention to the order of the parameters, which is important, and which may be different
than you expect. If you notice that the parameters coming from your function differ from those of 'polyfit',
think hard about how you might rearrange them to match. You have several options. For instance, you
could change the ordering of columns in the design matrix. Alternatively, you could look into the Matlab
functions 'fliplr' and 'flipud', which might help.

 
123 SEN
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
2223
regress_fit_poly.mx Unit5_Script.mx +
function b_hat =
% Name: regress_fit_poly
21
0-0-
% Inputs:
regress_fit_poly(x,y,p)
x A n-by-1 vector of feature values.
(where n is number of data points)
y A n-by-1 vector of response variable values
p - A scalar value, indicating the polynomial order
% Outputs:
b_hata (p+1)-by-1 vector of regression coefficients
% Created by: Adam C. Lammert (2020)
% Author: ??? (you)
%
% Description: Determine coefficients of a polynomial
regression model given x, y and p
%
20 % <your code goes here
return
%eof
several lines will be required>
AI
Transcribed Image Text:123 SEN 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 2223 regress_fit_poly.mx Unit5_Script.mx + function b_hat = % Name: regress_fit_poly 21 0-0- % Inputs: regress_fit_poly(x,y,p) x A n-by-1 vector of feature values. (where n is number of data points) y A n-by-1 vector of response variable values p - A scalar value, indicating the polynomial order % Outputs: b_hata (p+1)-by-1 vector of regression coefficients % Created by: Adam C. Lammert (2020) % Author: ??? (you) % % Description: Determine coefficients of a polynomial regression model given x, y and p % 20 % <your code goes here return %eof several lines will be required> AI
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Temporal Difference Learning
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education