{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework 13 Solution

# Homework 13 Solution - Lecture 13 MEEN 357 Homework...

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

Lecture 13 MEEN 357 Homework Solution 1 Lecture-13-Homework-Solution-2009.doc RMB 1. Problem 14.8 of the textbook. Solution : You are asked to apply multiple liner regression to the data 1 x 0 1 1 2 2 3 3 4 4 2 x 0 1 2 1 2 1 2 1 2 y 15.1 17.9 12.7 25.6 20.5 35.1 29.7 45.4 40.2 This problem is virtually identically to the example worked in class during Lecture 13. The script for that example modified is clc clear all x1=[0,1,1,2,2,3,3,4,4]' x2=[0,1,2,1,2,1,2,1,2]' y=[15.1,17.9,12.7,25.6,20.5,35.1,29.7,45.4,40.2]' A=[ones(9,1),x1,x2] %The direct solution of A'*A*c=A'*y is c=inv(A'*A)*A'*y %Or capitalizing on the special properties of the left division c=A\y %Plot of above results by the script plot3(x1,x2,y, 'o' , 'MarkerFaceColor' , 'k' , 'MarkerSize' ,11) xlabel( 'x_1' ),ylabel( 'x_2' ),zlabel( 'y' ) grid on hold x1values=[0:.1:4];x2values=[0:.1:2] [X1,X2]=meshgrid(x1values,x2values); yvalues=c(1)+c(2)*X1+c(3)*X2 mesh(X1,X2,yvalues) title( 'Exercise 14.8' ) The output is c = 14.4609 9.0252 -5.7043 or, equivalently, 1 2 14.409 9.0252 5.7042 y x x = + (13.1) The above script also generates the following plot

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

View Full Document
Lecture 13 MEEN 357 Homework Solution 2 Lecture-13-Homework-Solution-2009.doc RMB 2. Problem 14.9 of the textbook.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}