Predict responses using linear regression model
Statistics and Machine Learning Toolbox / Regression
The RegressionLinear Predict block predicts responses using a linear
regression object (
Import a trained regression object into the block by specifying the name of a workspace variable that contains the object. The input port x receives an observation (predictor data), and the output port yfit returns predicted responses for the observation.
Data TypesFixed-Point Operational Parameters
For linear regression models, the predicted response for the observation x is
y = xβ+b
β is the estimated column vector of coefficients, and
b is the estimated scalar bias. The linear regression model object
specified by Select trained machine learning
model contains the coefficients and bias in the
Bias properties, respectively. β and
b correspond to
Output data type determines the data type of the predicted response.
Inner product data type determines the data type of xβ.
When deciding whether to use the RegressionLinear Predict block in the
Statistics and Machine Learning Toolbox™ library or a MATLAB Function block with the
predict function, consider the
If you use the Statistics and Machine Learning Toolbox library block, you can use the Fixed-Point Tool (Fixed-Point Designer) to convert a floating-point model to fixed point.
Support for variable-size arrays must be enabled for a MATLAB Function block with the
If you use a MATLAB Function block, you can use MATLAB functions for preprocessing or post-processing before or after predictions in the same MATLAB Function block.
C/C++ Code Generation
Generate C and C++ code using Simulink® Coder™.
Design and simulate fixed-point systems using Fixed-Point Designer™.
Introduced in R2023a