How to use libsvm based svm regression model for prediction in simulink ?

2 views (last 30 days)
Dear Friends and Team, For one of my application, I am required to use libsvm based svm regression prediction model svmpredict in simulink. Currently I tried to achieve it through Simulink library MATLAB Function block, as shown in following code block
function y = fcn(SOC,Curr,Tamb,switch_in)
coder.extrinsic('svmpredict','net','polyvaln','evalin','assignin','mapminmax')
....
switch switch_in
case 1
%'model' is the output structure of svmtrain and svmpredict is
%external function
assignin('base','xtestn',xtestn);
estimate_out = svmpredict(y,xtestn, model);
disp(estimate_out);
estimate_out = 0;
But using this the block goes to somekind of infinite simulation, without keeping track of the time necessary to complete simulation on time.
hence this is causing a stalled simulation at Matlab Function block.
Could anyone help me understand the problem or could anyone suggest me an alternative approach, to achieve the same.
Your help is grately appreciated.

Answers (1)

Ricardo Gualavisi
Ricardo Gualavisi on 27 Jun 2016
Have you got any solution for this problem ? It would be very helpful for me. Thanks a lot!!

Categories

Find more on Simulink Functions in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!