【发布时间】:2019-04-22 14:46:16
【问题描述】:
我的 Simulink 模型中的 Matlab Function 模块有三个输入。输入由一维数组thetaArray 和两个变量currentIndex 和trackingError 组成。 Matlab 函数块将输出两个变量,分别称为newIndex 和theta。
使用newIndex 变量作为我在Matlab 函数块中的新输入的理想方法是什么?
Here is the image of my Simulink Model
这是模型中Matlab功能块的代码:
function [newIndex,theta] = arraySelector(thetaArray,currentIndex,trackingError)
if currentIndex < length(thetaArray) && trackingError <= 0.00002
newIndex = currentIndex + 1;
else
newIndex = currentIndex;
end
theta = thetaArray(newIndex);
end
提前谢谢你。
【问题讨论】:
-
通过单位延迟块发回。