Question: ` ` ` load golfdata.txt % load data from file into matrix ` golfdata ` driving = golfdata ( : , 1 ) ; scoring

```
load golfdata.txt % load data from file into matrix `golfdata`
driving = golfdata(:,1);
scoring = golfdata(:,2);
putting = golfdata(:,3);
birdies = golfdata(:,4);
``` You are given population data for a cubic model \( f \) that varies with time as follows:
\[
f(t)=a t^{3}+b t^{2}+c t+d+\delta_{t}
\]
where \( a, b, c \) and \( d \) are constants and \(\delta_{t}\) denotes a time-varying noise parameter. You do not need to compute the function.
Find the regression model of order 3 to fit the given data with time as the independent variable using polyfit.
1. Predict the population as a function of time and store the results in \(\mathbf{f}\)_pred.
2. Next, find out the mean absolute error between the prediction and the original data and store it in maevalue. not occur at the same time instance.
Script (
```
rng(101)
time =1:0.5:50;
delta = randi([-20,20], size(time));
a =-0.005;
b =0.28;
c =0;
d =100;
f = a * time.^3+ b * time.^2+ c * time + d + delta;
% Put your code here.
f_pred = zeros(1, length(time)); % placeholder, change it
% to compute predicted
% population
```
` ` ` load golfdata.txt % load data from file

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!