Question: Exercise 1 . ( Component Skill 5 . 3 ) USE MATLAB AND SHOW THE CODE PLEASE The file salmon _ data.mat contains the annual

Exercise 1.(Component Skill 5.3) USE MATLAB AND SHOW THE CODE PLEASE
The file salmon_data.mat contains the annual count of Chinook salmon taken at Bonneville on
the Columbia river from the years 1938 to 2020. In this problem, we will fit these data with various
polynomial curves to predict the salmon population in 2021.
a. Download the file salmon_data.mat from the Homework 5 page on Canvas. Make sure this
file is in the same folder as your hw5.m script. In the Exercise 1 section of your hw5.m script,
type
load('salmon_data.mat');
This will automatically create two variables. The first variable is called salmon. This is
an 831 column vector of the annual salmon count taken at Bonneville. The second variable
is called year. This is an 831 column vector of the corresponding years for which the salmon
count was recorded.
Treating salmon as the y-variable and year as the x-variable, use the MATLAB built-in func-
tion polyfit to find the coefficients of the first-degree polynomial that best fits the salmon
data in the least-squares sense. Assign the row vector of coefficients of this first-degree poly-
nomial to the variable A1. You may get MATLAB warnings about the polynomial
being badly conditioned. Normally, we'd heed these warnings, but let's ignore them for
the purposes of this exercise.
Answer:
b. Use the MATLAB built-in function polyfit to find the coefficients of the third-degree poly-
nomial that best fits the salmon data in the least-squares sense. Assign the row vector of
coefficients of this third-degree polynomial to the variable A2. c. Use the MATLAB built-in function polyfit to find the coefficients of the fifth-degree polynomial that best fits the salmon data in the least-squares sense. Assign the row vector of
coefficients of this fifth-degree polynomial to the variable A3. PLEASE USE MATLAB TO SOLVE ALL OF THESE QUESTIONS
Exercise 1 . ( Component Skill 5 . 3 ) USE MATLAB

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!