简体   繁体   English

在Matlab和Simulink中建模SIR模型

[英]Modeling SIR model in matlab and simulink

I am trying to model a SIR epidemic model in matlab and simulink. 我正在尝试在Matlab和Simulink中对SIR流行病模型进行建模。 I think I've already done it in matlab but for some reason my simulink model won't work. 我想我已经在matlab中完成了,但是由于某种原因,我的simulink模型无法正常工作。 It just shows straight lines in a scope. 它仅显示示波器中的直线。 This is my function to calculate differential equations. 这是我计算微分方程的功能。

function dx = sir(t, x)
  dx = [0; 0; 0];
  beta = .5; 
  delta = .3;
    dx(1) = -beta * x(1) * x(2);
    dx(2) = beta * x(1) * x(2) - delta * x(2);
    dx(3) = delta * x(2);
  end

This is my workspace code to show plot 这是我的工作区代码以显示情节 在此处输入图片说明 and this is mu simulink with yields this strange plot and this is after autoscaling with initial conditions set to S = 7900000 and R = 0 and I = 10 这是mu simulink,产生了这个奇怪的图,这是在自动缩放后,初始条件设置为S = 7900000和R = 0且I = 10 在此处输入图片说明

由Product3和Product2块馈入的求和块List of Signals属性应为|+-而不是|--

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM