gpt4 book ai didi

matlab - Simulink,这个 m 代码块在输入不匹配时如何工作?

转载 作者:太空宇宙 更新时间:2023-11-03 20:23:59 28 4
gpt4 key购买 nike

在 MATLAB Simulink 中,我添加了一个 MPC(模型预测控制 block )。

我查看了这个 block 的内部:

mpc1

在它里面有一个名为MPC 的包装器子系统。我通过双击打开了这个:

mpc2

此子系统中的主要模块是optimizer。此 block 是一个以此 header 开头的 m 代码块:

function [xk1, u, cost, useq, status, xest, iAout] = fcn(...
xk, old_u, ym, ref, md, umin, umax, ymin, ymax, switch_in, ext_mv, MVtarget, isQP, nx, nu, ny, degrees, Hinv, Kx, Ku1, Kut, Kr, Kv, Mlim, ...
Mx, Mu1, Mv, z_degrees, utarget, p, uoff, voff, yoff, maxiter, nxQP, openloopflag, ...
lims_inport, no_umin, no_umax, no_ymin, no_ymax, switch_inport, no_switch, enable_value, ...
return_cost, H, return_sequence, Linv, Ac, ...
ywt, uwt, duwt, rhoeps, iA, ...
no_ywt, no_uwt, no_duwt, no_rhoeps,...
Wy, Wdu, Jm, SuJm, Su1, Sx, Hv, Wu, I1, ...
A, Bu, Bv, C, Dv, Mrows, nCC, Ecc, Fcc, Scc, Gcc, ...
nv, no_md, no_ref, no_uref, no_mv, Rscale, MDscale, myindex, ...
myoff, xoff, CustomEstimation, M, L)
%#codegen
coder.extrinsic('mpcblock_optimizer_double_mex');
coder.extrinsic('mpcblock_optimizer_single_mex');
coder.extrinsic('mpcblock_refmd_double_mex');
coder.extrinsic('mpcblock_refmd_single_mex');

我的问题是,为什么代码中函数的输入数量远高于simulink中该 block 的输入端口数量。这些变量是在哪里产生的?例如,如何在调用此函数之前创建参数 H

此处附有 Simulink 文件:

https://www.dropbox.com/s/vx67urpkt9qki9e/simulink.zip?dl=0

最佳答案

我怀疑一些“输入”实际上不是输入,而是传递给函数的参数。参见 Add Parameter Arguments在文档中获取更多详细信息。

关于matlab - Simulink,这个 m 代码块在输入不匹配时如何工作?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35933635/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com