{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

hw6_solutionsMAE107

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

Info icon This preview shows pages 1–8. 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
Image of page 1

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

View Full Document Right 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)
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
Image of page 3

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

View Full Document Right 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 i =1 ( y i - mx i ) 2 Taking partial derivative w.r.t. m , ∂S r ∂m = - 2 ( 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
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))
Image of page 5

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

View Full Document Right 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
Image of page 6
MAE 107 Spring 2007 HW 6 Problem 3 Contents Function "polyreg" Typical use of "polyreg" Function "polyreg" clear; close all ; clc type polyreg.m % Function to perform polynomial regression function p = polyreg(x,y,m) % input: % x = independent variable % y = dependent variable % m = order of polynomial % output: %
Image of page 7

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

View Full Document Right Arrow Icon
Image of page 8
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern