Question
USING MATLAB 1) Use the following data (copy/paste into your script) to complete this problem: ()= 1 + 2 where, x = 0:0.1:20; noise =
USING MATLAB 1) Use the following data (copy/paste into your script) to complete this problem: ()= 1 + 2 where, x = 0:0.1:20; noise = ?? % a number, you need to define! y = 4*x + noise*rand(1,length(x)); % rand outputs uniformly distributed random numbers between 0 & 1. We will discuss later Vary the value for noise as 0, 50 and 100 to get three different results for 1 and 2, using the following 3 approaches: (a) From a linear algebra standpoint (solve a matrix equation), determine the coefficients, 1 and 2, of the least-squares-regression of a line fit through the data defined above. (b) Explore the polyfit function and compare your answers for the three tests in 4(a). Are they the same? Are they different? (c) Explore the regress function and compare your answer. Specifically, use the built- in function that allows output [B,BINT,R,RINT,STATS]. (For now, we will only need B, which is the solution matrix.) Are your answers for the coefficients the same? Report your results for 1 and 2 with all three values of noise and from all three methods in a supplementary Word document (in a table), or simply output the results to the command window.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started