Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Notes: Use MATLAB to write code in order to solve the following questions. Your program code should be properly commented; your evaluation will include being

Notes:

Use MATLAB to write code in order to solve the following questions.

Your program code should be properly commented; your evaluation will include being able to explain your code.

Submission Items:

Submit MATLAB source (.m) file(s) and snapshot of the output and graph (copied in a single document file) when you run the program for the conditions mentioned in the questions below.

Question 1: [13 points]

Note: Do not use MATLAB build-in functions for regression.

Write a MATLAB function that accepts n values of xi and yi , perform Linear Regression and returns values of r2 and, the model parameters a0 and a1 .

Write another MATLAB function that accepts n values of xi and yi (provided as arrays), checks for Linear, Power and Saturation growth-rate models, and estimate the values of parameters a0 and a1 (or and , whichever is applicable). In all three methods, the function should use the function developed in part (a) to perform the linear regression part. Plot the data and the three models (one linear and two non-linear) on the same graph (use distinct colors/shades of lines to differentiate). The function should return a number from 1-3 indicating the model with the best fit, its r2, and the estimated values of parameters.

Call the function from the command window with the data given below, capture the image of the output showing the returned values, and the graph, and include these in the Word document for submission.

x 0.75 2 3 4 6 8 8.5

-------------------------------------------------------------------------------

y 1.2 1.95 2 2.4 2.4 2.7 2.6

Question 2: [7 points]

Write a MATLAB function that accepts (n +1) values of xi and yi , fits nth order polynomial, evaluate it for certain x value using Lagrange Interpolating Polynomial, and returns the value of y at x .

Call this function from the command window with the data given in Question 1, evaluate y at x=7 , and capture the image of the output.

Refer to Figure 18.11 for the Pseudocode of the method.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Information And Database Systems 12th Asian Conference ACIIDS 2020 Phuket Thailand March 23 26 2020 Proceedings

Authors: Pawel Sitek ,Marcin Pietranik ,Marek Krotkiewicz ,Chutimet Srinilta

1st Edition

9811533792, 978-9811533792

More Books

Students also viewed these Databases questions

Question

What are the functions of dreams?

Answered: 1 week ago

Question

6. Explain the power of labels.

Answered: 1 week ago

Question

5. Give examples of variations in contextual rules.

Answered: 1 week ago

Question

f. What stereotypes were reinforced in the commercials?

Answered: 1 week ago