How to Import RegressionGP model to Simulink

조회 수: 2 (최근 30일)
KE FANG
KE FANG 2018년 7월 9일
답변: Shota Kato 2020년 1월 3일
Hi, I have trained a GPS model and it's in the base workspace (1x1 RegressionGP). How can I import it to a Simulink model? Is there a way to easily populate a Simulink Block of it? Thanks.

채택된 답변

Shota Kato
Shota Kato 2020년 1월 3일
Hi, I had the same problem.
You can solve the problem by using "saveCompactModel" and "loadCompactModel".
Given the trained model, you can sace the model ("Mdl") to a file named "Model.mat".
Mdl = fitrgp(X, Y);
saveCompactModel(Mdl, 'Model');
In a Simulink model, for example, you can use MATLAB Function and load the model as follow;
function y = compute_y(x)
Mdl = loadCompactModel('Model');
y = predict(Mdl, x);
end

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Create Large-Scale Model Components에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by