hw6_solutionsMAE107

hw6_solutionsMAE107 - MAE 107 Spring 2007 HW 6 Problem 1...

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

View Full Document Right Arrow Icon
MAE 107 Spring 2007 HW 6 Problem 1 Contents Plot data Linear regression Flow for x = 120 Plot data clear; close all ; clc % Store data in (x,y) x = [88.9 108.5 104.1 139.7 127 94 116.8 99.1] % precipitation y = [14.6 16.7 15.3 23.2 19.5 16.1 18.1 16.6] % flow % Sort data in (X,Y) [X, I] = sort(x); Y = y(I); % Plot figure; hold on ; plot(X, Y, 'o' ); x = 88.9000 108.5000 104.1000 139.7000 127.0000 94.0000 116.8000 99.1000 y = 14.6000 16.7000 15.3000 23.2000 19.5000 16.1000 18.1000 16.6000
Background image of page 1

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

View Full DocumentRight Arrow Icon
Linear regression p = polyfit(X, Y, 1); fprintf( 'Fitted polynomial: y = (%8.6f) * x + (%8.6f)\n' , p(1), p(2)); % Plot line line([X(1) X(end)], [polyval(p, X(1)) polyval(p, X(end))]) Fitted polynomial: y = (0.151871) * x + (0.842783)
Background image of page 2
Flow for x = 120 xbar = 120; ybar = polyval(p, xbar); fprintf( 'Flow for xbar = 120: ybar = (%8.6f) * 120 + (%8.6f) = %8.6f\n' , ... p(1), p(2), ybar); Flow for xbar = 120: ybar = (0.151871) * 120 + (0.842783) = 19.067277 Published with MATLAB® 7.4
Background image of page 3

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

View Full DocumentRight Arrow Icon
HW6, Prob 1: Part(d) We redo the regression with zero intercept to give. Let the new fit be of the for y = mx . The square sum of residuals is, S r = n X i =1 ( y i - mx i ) 2 Taking partial derivative w.r.t. m , ∂S r ∂m = - 2 X ( y i - mx i ) x i = 0 m = y i x i x 2 i which gives, m = 0 . 1594 and y = 0 . 1594 x . Thus, the model is, flow = (0 . 1594) * precipitaton . Maximum flow is, Q m = A ( km 2 ) * P ( cm/year ) For A = 1100 km 2 , converting flow units to m 3 /s , Q m = 0 . 348808 P Using slope from the linear regression with zero intercept, fraction of the total flow can be computed as, F = 0 . 348808 - 0 . 1594 0 . 348808 = 0 . 543
Background image of page 4
MAE 107 Spring 2007 HW 6 Problem 2 Contents Linearization Regression Plot Linearization We take natural log on both sides of the equations to get, clear; close all ; clc T = [0 5 [10:10:40]]; Ta = T + 273.15 mu = [1.787 1.519 1.307 1.002 0.7975 0.6529] X = 1 ./ Ta Y = log(mu) Ta = 273.1500 278.1500 283.1500 293.1500 303.1500 313.1500 mu = 1.7870 1.5190 1.3070 1.0020 0.7975 0.6529 X = 0.0037 0.0036 0.0035 0.0034 0.0033 0.0032 Y = 0.5805 0.4181 0.2677 0.0020 -0.2263 -0.4263 Regression p = polyfit(X, Y, 1); B = p(1) D = exp(p(2))
Background image of page 5

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

View Full DocumentRight Arrow Icon
B = 2.1508e+03 D = 6.6594e-04 Plot Ta2 = [270:320]; mu2 = exp( log(D) + B ./ Ta2 ) ; plot(Ta, mu, 'o' , Ta2, mu2) title( 'Fit vs. actual values for Andrade''s equation' ) Published with MATLAB® 7.4
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 12

hw6_solutionsMAE107 - MAE 107 Spring 2007 HW 6 Problem 1...

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

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