Linear Regression Model in Simulink with Blocks

Hi, I was wondering how I could implement my trained linear regression model on Simulink, the model involves training a sinusoidal wave that has 100 samples to apply a gain to its amplitude. How would I go about creating a function for such a model, and what kind of blocks would I use on Simulink?

 Respuesta aceptada

Drew
Drew el 6 de Nov. de 2023

0 votos

Since 23a, MathWorks provides a Regression Linear Predict block for Simulink. See https://www.mathworks.com/help/stats/predict-responses-using-regression-linear-predict-block.html
More generally, see the "Regression Predict Blocks" section of the page https://www.mathworks.com/help/stats/code-generation.html
If this answer helps you, please remember to accept the answer.

4 comentarios

Hamza Farah
Hamza Farah el 6 de Nov. de 2023
Hi, the Regression Linear Predict Block only accepts models directly from the regression learner app. The models that I am making would require me to use the MATLAB function block, the data that I am using to train the model is an excel spreadsheet that includes a sine signal over 100 samples. How would I go about this?
Drew
Drew el 6 de Nov. de 2023
The Regression Linear Predict block accepts any RegressionLinear model. The RegressionLinear model does not need to come from the Regression Learner.
Have you already trained your model? Is your question more about how to train the model?
If your model requires using a MATLAB function block, then you can go ahead and use that block.
Hamza Farah
Hamza Farah el 6 de Nov. de 2023
Yes I have already trained my model. I have tried to input my model that I made with the fitlm function, and I keep getting this error on the linear regression block.
Hamza Farah
Hamza Farah el 6 de Nov. de 2023
Hi Drew, I managed to find the problem, thanks for the help!

Iniciar sesión para comentar.

Más respuestas (0)

Etiquetas

Preguntada:

el 5 de Nov. de 2023

Comentada:

el 6 de Nov. de 2023

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by