Homework 11 Solution

Homework 11 Solution - Lecture 11 MEEN 357 Homework...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
Lecture 11 MEEN 357 Homework Solution 1 Lecture-11-Homework-Solution-2009.doc RMB 1. Problem 13.5 of the textbook. Solution: This problem is almost identical to the Example on page 16 of the notes for Lecture 11. Given the table of data in the problem statement, the following script produces the coefficients in the linear regression, the standard error and the correlation coefficient %Problem 13.5 clc,clear all x=[0,2,4,6,9,11,12,15,17,19]'; y=[5,6,7,6,9,8,7,10,12,12]'; A=[x.^0,x.^1]; c=A\y; n=size(x); Sr=(y-A*c)'*(y-A*c); St=(y-mean(y))'*(y-mean(y)); StdError=sqrt(Sr/(n(1)-2)) CorrelationCoeff=sqrt((St-Sr)/St) The output is c = 4.8515 0.3525 StdError = 1.0650 CorrelationCoeff = 0.9148 The plot of the data and the regression line is obtained by adding the script to that above plot(x,y, 'o' , 'markerfacecolor' , 'k' ) grid on xlabel( 'x' ) ylabel( 'y' ) title( 'Problem 13.5' ) hold on %Plot of Linear Regression
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Lecture 11 MEEN 357 Homework Solution 2 Lecture-11-Homework-Solution-2009.doc RMB xvalues=[0:1:19] yvalues=c(1)+c(2)*xvalues plot(xvalues,yvalues, 'r' , 'LineWidth' ,2) The output is the plot If the roles of x and y
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 6

Homework 11 Solution - Lecture 11 MEEN 357 Homework...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online