Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

matlab DEBUG CODE S. (10 pts) Consider the following code, which calculates the two linear regression coefficien the problem at the bottom of the page:

image text in transcribedmatlab

DEBUG CODE S. (10 pts) Consider the following code, which calculates the two linear regression coefficien the problem at the bottom of the page: Function [al, a0]-linreg2 (x, y) n=length (x) ; sumx-0; sumx2 0 ssumy 0 7 for i=1:n sunxy sunxytX ( ) * y ( i ) ; sumx= sumx+x (i) ; sumy-sumyty (i); sunx2=sumx2 +x(1)^2; 11 12end 13a1= (nt sumxy-sumx * sumy) / (n* sumx2-sumx^2 ) ; 4 a0-sumy-al*sumx; send When the function is called in the command window, the following appears: >> linreg2 ([3 4 5], [10 8 6]) ans = This issue may have occurred for you during the semester. The code indicates in the function declaration line that there should be two outputs. Fix the problem so that both outputs are printed and saved and report what the outputs will be

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

Database And Transaction Processing

Authors: Philip M. Lewis, Arthur Bernstein, Michael Kifer

1st Edition

0201708728, 978-0201708721

Students also viewed these Databases questions