# Comparing Polynomials and Neural Network to Modelling Injection Dosages in Modern CI Engines
## 2 Materials and Methods
### Modelling of Injection Doses with the Use of a Polynomial  
The injection dose size modelling was performed in the Matlab environment. Two methods were compared in the work: by means of a polynomial developed with the use of the Curve Fitting Tools application and by the implementation of a neural network.  
With the help of the Matlab Curve Fitting Tools add-on, a polynomial was developed, on the basis of which a map of possible injection doses was determined depending on two parameters: system pressure and the injector actuation time (Figure 4).  
In the case of the conducted analysis, the most favorable results were achieved with a polynomial with a variable x of the fourth degree and y of the fifth degree. On the basis of statistical values such as \(SSE\), \(R\)-square, adjusted \(R\)-square, RMSE, the accuracy of the developed polynomials to the measurement results was assessed. Thanks to this, we were able to assess which equation most faithfully reproduces the injector's behavior. Table 1 presents the statistical values.  
Statistical values are determined according to mathematical formulas. The sum of squares due error (\(SSE\)) is determined from the following Equation (8).  
\[SSE=\sum_{i=1}^{n}\bigl{(}Y_{i}-\hat{Y}_{i}\bigr{)}^{2} \tag{8}\]  
where \(Y_{i}\) is the actual value of the dependent variable, \(\hat{Y}_{i}\)--predicted value of the dependent variable based on the regression model.  
The \(SSE\) is the sum of the deviations of the \(Y_{i}\) value from the regression line. This coefficient equal to zero occurs with a perfect fit of the model. When evaluating different variants of a polynomial, care should be taken to keep the \(SSE\) as close to zero as possible.  
Figure 4: Characteristics of injection doses depending on pressure and injection time. \(X\) axis— pressure [MPa], \(Y\) axis—injection time [\(\upmu\)s], \(Z\) axis—injection dose [\(\mathrm{mm}^{3}/\mathrm{H}\)].  
Figure 3: A diagram of a neural network that allowed to create a brain that determines the dose of injectors depending on pressure and time.  
The \(R\)-square factor is a measure of the quality of a model fit. It is also called the coefficient of determination. This coefficient takes values from 0 to 1. However, the closer to the value 1, the more accurate the model. The coefficient of determination is calculated from the following relationship (9).  
\[R^{2}=\frac{\sum_{i}^{n}\left(\hat{Y}_{i}-\overline{Y}\right)^{2}}{\sum_{i=1}^{n }\left(Y_{i}-\overline{Y}\right)^{2}} \tag{9}\]  
where \(\hat{Y}_{i}\) is the predicted value of the dependent variable based on the regression model, \(Y_{i}\) is the actual value of the dependent variable, \(\overline{Y}\) is the mean value of the actual dependent variable.  
The task of the adjusted \(R\)-square determination coefficient is to eliminate useless explanatory variables from the model.  
Adjusted \(R\)-square--is the modified \(R\)-square factor. The above factor is determined from the following formula (10):  
\[\widehat{R}^{2}=1-\frac{n-1}{n-m-1}\left(1-R^{2}\right), \tag{10}\]  
where: \(b\)--the number of observations, \(m\)--the number of explanatory variables.  
The above coefficient is very useful when we have several polynomials with an approximate \(R\)-squared value and at this point it is difficult to clearly state which proposed model is better. The use of the adjusted coefficient of determination solves this problem and indicates more precisely which polynomial proposed in this case is more accurate. It is worth noting that the above factor will always be less than the \(R\)-squared factor.  
The \(RMSE\) (root mean squared error) is a measure of the difference between the values predicted by the model and the observed values. The closer the value is to zero, the more accurate the model. The formula is as follows, relations (11) and (12):  
\[RMSE=s=\sqrt{MSE}, \tag{11}\]  
\[MSE=\frac{SSE}{v}, \tag{12}\]  
where: \(SSE\) is Sum of squares due error, \(v\) is the number of samples.