哈喽,各位大神
我想在的问题是想把一个包含了三个funtion的程序转换成simulink中运行,因为之后要与Powerfactory一起运行。这三个函数之间有调用关系。
之前想用matlab function,但是他直接忽略了后两个函数,不太想用s-function,不知道各位大神有什么好的建议吗。
m函数如下:
function [YTS]=rtenspred(treeensemble,XTSA)
% inputs:
% tree: a tree output by the function rtenslearn_c
% XTS: inputs for the test cases
% YLS: outputs for the learning sample cases
% Output:
% YTS: Predictions for the test cases
verbose=0;
global XTS;
global tree;
XTS=XTSA;
Nts=size(XTS,1);
T=length(treeensemble.trees);
YTS=0;
for t=1:T
if (verbose)
fprintf('t=%dn',t);
end
tree=treeensemble.trees(t);
YTS=YTS+tree.weight*rtpred();
end
function [YTS]=rtpred()
%
最后
以上就是欢喜小鸭子最近收集整理的关于用matlab把代码转成模型,如何把MATLAB中.m文件转换成Simulink模块的全部内容,更多相关用matlab把代码转成模型,如何把MATLAB中内容请搜索靠谱客的其他文章。
发表评论 取消回复