MatLabHW4 - Linear model Poly4: f(x) = p1*x^4 + p2*x^3 +...

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

View Full Document Right Arrow Icon
%   %  Blake Hampton  %  MatLab Section PQ %   % Homework Number 4   % Due Date: 10/28/10 % %  Problem # 12.1 V = [1 2 3 4 5 6]; P = [2494 1247 831 623 499 416]; %a. interp1(V,P,3.8) %b. interp1(V,P,3.8, 'spline' ) %c. interp1(P,V,1000) %d. interp1(P,V,1000, 'spline' ) %Solution ans = 664.6000 ans = 657.4373 ans = 2.5938 ans = 2.4779 % p. 492 #12.7 V1 = 1:.2:6; a = polyval(polyfit(V,P,1),V1); b = polyval(polyfit(V,P,2),V1); c = polyval(polyfit(V,P,3),V1); d = polyval(polyfit(V,P,4),V1); subplot(2,2,1)
Background image of page 1

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

View Full DocumentRight Arrow Icon
plot(V,P, 'ok' ,V1,a, '-r' ) xlabel( 'Volume (m^3)' ); ylabel( 'Pressure (kPa)' ); title( 'Volume vs. Pressure (First Order)' ); subplot(2,2,2) plot(V,P, 'ok' ,V1,b, '-b' ) xlabel( 'Volume (m^3)' ); ylabel( 'Pressure (kPa)' ); title( 'Volume vs. Pressure (Second Order)' ); subplot(2,2,3) plot(V,P, 'ok' ,V1,c, '-g' ) xlabel( 'Volume (m^3)' ); ylabel( 'Pressure (kPa)' ); title( 'Volume vs. Pressure (Third Order)' ); subplot(2,2,4) plot(V,P, 'ok' ,V1,d, '-k' ) xlabel( 'Volume (m^3)' ); ylabel( 'Pressure (kPa)' ); title( 'Volume vs. Pressure (Fourth Order)' );
Background image of page 2
The 4 th -order model seems to be the best fit.
Background image of page 3

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

View Full DocumentRight Arrow Icon
Background image of page 4
Background image of page 5
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Linear model Poly4: f(x) = p1*x^4 + p2*x^3 + p3*x^2 + p4*x + p5 Coefficients (with 95% confidence bounds): p1 = 12.08 (-24.8, 48.97) p2 = -209.2 (-727.2, 308.9) p3 = 1351 (-1149, 3851) p4 = -4007 (-8783, 768.3) p5 = 5346 (2429, 8262) Goodness of fit: SSE: 693.3 R-square: 0.9998 Adjusted R-square: 0.9989 RMSE: 26.33 The fourth-order model is the best as its R-square value is the closest to 1. % #12.9 R = [10 15 25 40 65 100]; I = [11.11 8.04 6.03 2.77 1.97 1.51]; %a. plot(R,I) xlabel( 'Resistance (ohms)' ) ylabel( 'Current (amps)' ) title( 'Resistance vs. Current' ) %b. figure plot(1./R,I) xlabel( '1/Resistance (ohms)' ) ylabel( 'Current (amps)' ) title( '1/Resistance vs. Current' ) %c. a = polyfit(R,I,1); a =-0.0949 9.2716 % Coefficients of function. %d. b = polyval(a,R); figure plot(R,b, '-k' ,R,I, 'o' ) xlabel( 'Resistance (ohms)' ) ylabel( 'Current (amps)' ) title( 'Resistance vs. Current' )...
View Full Document

Page1 / 5

MatLabHW4 - Linear model Poly4: f(x) = p1*x^4 + p2*x^3 +...

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

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