Matlab 带设定点步长的Sim命令
我使用Matlab 带设定点步长的Sim命令,matlab,Matlab,我使用sim命令在Matlab中绘制操纵变量和设备输出: sim(MPC, 500/T_p, [h_0, T_0]); MPC当然是模拟模型,[h_0,T_0]是工厂输出的设定点。它工作正常,但设定点在时间上是恒定的。是否有任何方法可以配置sim命令,使设定点在时间上发生变化(例如,n个间隔后的步长+50%)@Adrian是正确的,sim确实可以将[n x 2]维度的矩阵作为输入。因此,答案大致是: % step properties step_time = 50; h_step_coeff
sim
命令在Matlab中绘制操纵变量和设备输出:
sim(MPC, 500/T_p, [h_0, T_0]);
MPC
当然是模拟模型,[h_0,T_0]
是工厂输出的设定点。它工作正常,但设定点在时间上是恒定的。是否有任何方法可以配置sim
命令,使设定点在时间上发生变化(例如,n个间隔后的步长+50%)@Adrian是正确的,sim
确实可以将[n x 2]
维度的矩阵作为输入。因此,答案大致是:
% step properties
step_time = 50;
h_step_coeff = 1.5;
T_step_coeff = 1;
% construct setpoints matrix, run simulation
offset = round(step_time/T_p);
setpoints = repmat([h_0, T_0], offset, 1);
setpoints_step = repmat([h_0*h_step_coeff, T_0*T_step_coeff], round(500/T_p) - offset, 1);
setpoints = cat(1, setpoints, setpoints_step);
sim(MPC, 500/T_p, setpoints);
我不确定
sim
是否可以将[nx2]
矩阵作为输入,否则您可以循环使用它。