Matlab &引用;警告:模拟将在非零初始时间开始”;如何修复此错误?

Matlab &引用;警告:模拟将在非零初始时间开始”;如何修复此错误?,matlab,plot,discrete-mathematics,Matlab,Plot,Discrete Mathematics,这是我的代码我如何避免“警告:模拟将在非零初始时间开始” 由于您正在模拟一个时不变系统,因此在调用lsim命令时,只需将时间向量从零开始移动即可。结果向量y在两种情况下都是相同的,但移位的情况下不会出现警告: >> y = lsim(sistema,u,t,x0) Warning: Simulation will start at a nonzero initial time. y = 0.9914 0.9898 0.9883 0.9872 0.9866 0

这是我的代码我如何避免“警告:模拟将在非零初始时间开始”


由于您正在模拟一个时不变系统,因此在调用
lsim
命令时,只需将时间向量从零开始移动即可。结果向量
y
在两种情况下都是相同的,但移位的情况下不会出现警告:

>> y = lsim(sistema,u,t,x0)
Warning: Simulation will start at a nonzero initial time. 
y =
  0.9914
  0.9898
  0.9883
  0.9872
  0.9866
  0.9863
  0.9859

>> y = lsim(sistema,u,t-t(1),x0)
y =
  0.9914
  0.9898
  0.9883
  0.9872
  0.9866
  0.9863
  0.9859

@Kavka的建议也是我修正警告的方法;但是,您可以使用
警告
()返回关闭该警告。使用
lastwarn
获取警告

>> y = lsim(sistema,u,t,x0)
Warning: Simulation will start at a nonzero initial time. 
y =
  0.9914
  0.9898
  0.9883
  0.9872
  0.9866
  0.9863
  0.9859

>> y = lsim(sistema,u,t-t(1),x0)
y =
  0.9914
  0.9898
  0.9883
  0.9872
  0.9866
  0.9863
  0.9859