我的函数tomrun有错误。我在embuldeed blocks的simulink中运行。这是代码
Wnl = 1;
dw = zeros (2,10);
dw = [Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl;
Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl];
Prob = qpAssign(FF, S, Alpha, b_L(1:7), b_U(1:7), [], [], [], [],...
[], [], [], [], [], [], []);
Result = tomRun('qpSolve', Prob, 1)
eml.extrinsic('extractResult');
dwp = extractResult(Result)
dwopt = [0 0];
dwopt = dw
wstart = [0.98 0.99];
Wnlop = wstart + dwopt ;
%%function extract results
function dww = extractResult(Result)
dww = Result.x_k;
end
我正在接受这个错误 嵌入式MATLAB接口错误:MATLAB表达式的大小不匹配' dwp'。预期= 1x2实际= 2x1块load_sharing(#19)执行时:无。
我试图改变大小,但我又犯了同样的错误,有人能帮帮我吗?
答案 0 :(得分:0)
这是嵌入块中的代码
function Wnlop = loadsharing_Linearization_MPC(Wnlop3)%,e)
Wnl = 1;
dw = zeros (2,10);
dw = [Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl;
Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl Wnl];
FF = [ 945.8209 868.6367
868.6367 797.7697];
S = [ -273.5275
-251.1619];
Alpha = [ 0 0
7.9634 7.3155
0 0
0.1303 0.1307
7.9634 7.3155
-7.9634 -7.3155
0 0];
b_L = [29.1083 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583
29.1083 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583
-Inf 29.1540 29.1561 29.1561 29.1561 29.1561 29.1561 29.1561 29.1561 29.1561
-Inf 29.1561 27.1562 -0.0366 14.0596 14.0597 14.0597 -14.0597 0 0
57.3266 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166
-Inf 0 0 0 0 0 0 0 0 0
28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583];
b_U =[ 29.2083 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583
29.2083 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583
31.6583 29.1540 29.1561 29.1561 29.1561 29.1561 29.1561 29.1561 29.1561 29.1561
31.4061 29.1561 27.1562 -0.0366 14.0596 14.0597 14.0597 -14.0597 0 0
Inf 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166 56.3166
0.9700 0 0 0 0 0 0 0 0 0
Inf 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583 28.1583];
eml.extrinsic('extractResult');
eml.extrinsic('qpAssign','tomRun');
Prob = qpAssign(FF, S, Alpha, b_L(1:7), b_U(1:7), [], [], [], [],...
[], [], [], [], [], [], []);
Result = tomRun('qpSolve', Prob, 1)
eml.extrinsic('extractResult');
dwp = extractResult(Result)
dwopt = [0 0];
dwopt = dw
wstart = [0.98 0.99]
Wnlop = wstart + dwopt ;