【程序语言】【MATLAB】Invalid constructs include the use of persistent or global variables

在Simulink里面对速度曲线积分,直接在速度模块后面接积分器
【程序语言】【MATLAB】Invalid constructs include the use of persistent or global variables
有一个报错信息:
【程序语言】【MATLAB】Invalid constructs include the use of persistent or global variables
因为在Simulink里面用到了全局变量,MATLAB answer里面给了一个解释

You can switch the entire model to discrete time or you can use rate transition blocks to move back and forth between continuous and discrete .

也就是说要把连续变量转化成离散量才能正常使用。把积分器改成Rate Transition和Discrete-Time Integrator就解决了

【程序语言】【MATLAB】Invalid constructs include the use of persistent or global variables