Question 6.3: Using polynomial regression for curve fitting of stress-stra......

Using polynomial regression for curve fitting of stress-strain curve.

A tension test is conducted for determining the stress-strain behavior of rubber. The data points from the test are shown in the figure, and their values are given below. Determine the fourth order polynomial that best fits the data points. Make a plot of the data points and the curve that corresponds to the polynomial.

\begin{array}{lc} \text { Strain } \varepsilon & 0 & 0.4 & 0.8 & 1.2 & 1.6 & 2.0 & 2.4 & \\ \text { Stress } \sigma(\mathrm{MPa}) & 0 & 3.0 & 4.5 & 5.8 & 5.9 & 5.8 & 6.2 & \\ \text { Strain } \varepsilon & 2.8 & 3.2 & 3.6 & 4.0 & 4.4 & 4.8 & 5.2 & 5.6 & 6.0 \\ \text { Stress } \sigma(\mathrm{MPa}) & 7.4 & 9.6 & 15.6 & 20.7 & 26.7 & 31.1 & 35.6 & 39.3 & 41.5\\ \end{array}
6.3
Step-by-Step
The 'Blue Check Mark' means that this solution was answered by an expert.
Learn more on how do we answer questions.

A polynomial of the fourth order can be written as:

f(x)=a_{4} x^{4}+a_{3} x^{3}+a_{2} x^{2}+a_{1} x+a_{0}     (6.29)

Curve fitting of 16 data points with this polynomial is done by polynomial regression. The values of the five coefficients a_{0}, a_{1}, a_{2}, a_{3}, and a_{4} are obtained by solving a system of five linear equations. The five equations can be written by extending Eqs. (6.26)-(6.28).

\begin{aligned}n a_0+\left(\sum_{i=1}^n x_i\right) a_1+\left(\sum_{i=1}^n x_i^2\right) a_2&=\sum_{i=1}^n y_i \qquad (6.26)\\ \left(\sum_{i=1}^n x_i\right) a_0+\left(\sum_{i=1}^n x_i^2\right) a_1+\left(\sum_{i=1}^n x_i^3\right) a_2&=\sum_{i=1}^n x_i y_i \qquad (6.27)\\ \left(\sum_{i=1}^n x_i^2\right) a_0+\left(\sum_{i=1}^n x_i^3\right) a_1+\left(\sum_{i=1}^n x_i^4\right) a_2&=\sum_{i=1}^n x_i^2 y_i \qquad (6.28) \end{aligned}

\begin{aligned}n a_0+\left(\sum_{i=1}^n x_i\right) a_1+\left(\sum_{i=1}^n x_i^2\right) a_2+\left(\sum_{i=1}^n x_i^3\right) a_3+\left(\sum_{i=1}^n x_i^4\right) a_4=\sum_{i=1}^n y_i\end{aligned}        (6.30)

\begin{aligned} & \left(\sum_{i=1}^{n} x_{i}\right) a_{0}+\left(\sum_{i=1}^{n} x_{i}^{2}\right) a_{1}+\left(\sum_{i=1}^{n} x_{i}^{3}\right) a_{2}+\left(\sum_{i=1}^{n} x_{i}^{4}\right) a_{3}+\left(\sum_{i=1}^{n} x_{i}^{5}\right) a_{4}=\sum_{i=1}^{n} x_{i} y_{i} \quad (6.31) \\ & \left(\sum_{i=1}^{n} x_{i}^{2}\right) a_{0}+\left(\sum_{i=1}^{n} x_{i}^{3}\right) a_{1}+\left(\sum_{i=1}^{n} x_{i}^{4}\right) a_{2}+\left(\sum_{i=1}^{n} x_{i}^{5}\right) a_{3}+\left(\sum_{i=1}^{n} x_{i}^{6}\right) a_{4}=\sum_{i=1}^{n} x_{i}^{2} y_{i} \quad (6.32)\\ & \left(\sum_{i=1}^{n} x_{i}^{3}\right) a_{0}+\left(\sum_{i=1}^{n} x_{i}^{4}\right) a_{1}+\left(\sum_{i=1}^{n} x_{i}^{5}\right) a_{2}+\left(\sum_{i=1}^{n} x_{i}^{6}\right) a_{3}+\left(\sum_{i=1}^{n} x_{i}^{7}\right) a_{4}=\sum_{i=1}^{n} x_{i}^{3} y_{i} \quad (6.33)\\ & \left(\sum_{i=1}^{n} x_{i}^{4}\right) a_{0}+\left(\sum_{i=1}^{n} x_{i}^{5}\right) a_{1}+\left(\sum_{i=1}^{n} x_{i}^{6}\right) a_{2}+\left(\sum_{i=1}^{n} x_{i}^{7}\right) a_{3}+\left(\sum_{i=1}^{n} x_{i}^{8}\right) a_{4}=\sum_{i=1}^{n} x_{i}^{4} y_{i} \quad (6.34) \end{aligned}

The calculations and the plot are done with MATLAB in a script file that is listed below. The computer program follows these steps:

Step 1: Create vectors \mathrm{x} and \mathrm{y} with the data points.

Step 2: Create a vector xsum in which the elements are the summation terms of the powers of x_{i}.

For example, the fourth element is: x \operatorname{sum}(4)=\sum\limits_{i=1}^n x_{i}^{4}

Step 3: Set up the system of five linear equations (Eqs. (6.30)-(6.34)) in the form [a][p] = [b], where [a] is the matrix with the summation terms of the powers of x_{i},[p] is the vector of the unknowns (the coefficients of the polynomial), and [b] is a vector of the summation terms on the right-hand side of Eqs. (6.30)-(6.34).

Step 4: Solve the system of five linear equations [a][p] = [b] (Eqs. (6.30)-(6.34)) for p, by using MATLAB’s left division. The solution is a vector with the coefficients of the fourth order polynomial that best fits the data.

Step 5: Plot the data points and the curve-fitting polynomial.

The 'Blue Check Mark' means that either the MATLAB code/script/answer provided in the answer section has been tested by our team of experts; or the answer in general has be fact checked.

Learn more on how do we answer questions.

Script File

Program 6-3: Script file. Curve fitting using polynomial regression.

clear all x=0:0.4: 6;
y=[0 3 4.5 5.8 5.9 5.8 6.2 7.4 9.6 15.6 20.7 26.7 31.1 35.6 39.3 41.5];
n=lenqth(x); m=4;
for i=1:2*m

xsum(i)=sum(x.A(i));

end
% Beginning of Step 3

a(1,1)=n;

b(1,1)=sum(y);
for j=2:m + 1

a(1,j)=xsum(j-1);

end

for i= 2:m + 1

for j= 1:m + 1

a ( i , j ) = xsum ( j + i - 2) ;

end

b(i,1)= sum(x.^(i - 1) .*y) ;

end

% Step 4

p= (a\b) I

for i= 1:m + 1

Pcoef(i= p(m + 2 - i) ;

end

epsilon= o : o .1:6;

stressfit= polyval(Pcoef,epsilon) ;

plot(x,y,'re',epsilon,stressfit,'k',

xlabel('Strain','fontsize',20)

ylabel('Stress (MPa) ','fontsize',20)

When the program is executed, the solution [p] is displayed in the Command Window. In addition, the plot of the data points and the curve-fitting polynomial is displayed in the Figure Window.

p =

-0.2746   12.8780   -10.1927    3.1185    -0.2644

The curve-fitting polynomial is:

f(x)=(-0.2644) x^{4}+3.1185 x^{3}-10.1927 x^{2}+12.878 x-0.2746

Note: In MATLAB a polynomial is represented by a vector whose elements are the polynomial's coefficients. The first element in the vector is the coefficient of the highest order term in the polynomial, and the last element in the vector is the coefficient a_{0}.

6.31

Related Answered Questions