Effacer les filtres
Effacer les filtres

How to call neural network .mat file during the Simulink simulation?

3 vues (au cours des 30 derniers jours)
Young Jae Choi
Young Jae Choi le 24 Juil 2020
Commenté : Hexuan Li le 8 Juil 2021
Hi,
I have made an neural network model by using 'fitnet' function in Matlab and saved it as 'ANN2.mat'
In my simulink model, I would like to use this nn model to predict an output. (the simulink model is expressed below)
What I have done is put a 'm-function' and script is like this:
function y = fcn(Tset, Tsa, Tra, Qair, dT_w)
load ANN2
input = [Tset, Tsa, Tra, Qair, dT_w]'
output = net(input)
y = output;
But an error occurs:
As I don't know much about matlab & simulink, it is hard for me to understand the error and how to solve.
What is wrong with my script?
Is there any method to import my neural network model as .m or .mat file and execute it?
Because I'm trying to train nn model with new data which is generated by every simulink timestep, I want to avoid using blocks supporting from simulink.
Thank you very much in advance for your time.
  1 commentaire
Hexuan Li
Hexuan Li le 8 Juil 2021
Hi,
Do you fix this issue? because I also meet a same problem in simulink

Connectez-vous pour commenter.

Réponses (1)

Harsha Priya Daggubati
Harsha Priya Daggubati le 27 Juil 2020
Hi,
I guess the error might be because of using 'net'. Since you saved the network as ANN2 you need to use ANN2(input) instead of net.
You can also look at the following link for a list of options available to use Simulink to train a neural network:
Hope this helps!

Catégories

En savoir plus sur Sequence and Numeric Feature Data Workflows dans Help Center et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by