Unformatted text preview: a0 = a(1); a1 = a(2); a2 = a(3); a y_regressed = a0 + a1*x + a2*x.*x; plot (x, y, 'o', x, y_regressed); xlabel('r (m)'); ylabel('v (m/s)'); legend('Data', 'Regression'); l % open file fid4 = fopen('hw11_p05_answer.txt','a'); % 'wt' means "write text" if (fid4 < 0) error('could not open file "hw11_p05_answer.txt"'); end; e fprintf(fid4, '\nv = (%10.5f) + (%10.5f)r + (%10.5f)r^2\n', a0, a1, a2); f % Analytical function obtained: y = a0 + a1*x + a2*x^2 % Analytical integration for 2*pi*(a0*x + a1*x^2 + a2*x^3) Q_analytical = 2*pi*(a0/2.0*(R2^2  R1^2) + a1/3.0*(R2^3  R1^3) + a2/4.0*(R2^4  R1^4)); R fprintf(fid4, 'Q_analytical = %10.5f m^3/s\n', Q_analytical); fclose(fid4);...
View
Full Document
 Spring '08
 Chelikowsky
 Regression Analysis, Conversion of units, Pallavolo Modena, order polynomial regression

Click to edit the document details