matlab - 为什么我的第三个 MATLAB 函数在使用 ode45 时只输出零?
问题描述
我需要使用 MATLAB 为我的系统生物学课模拟基因的负、正和简单调控。问题是负调节功能和简单调节功能有效,而正调节功能仅输出零。
我的脚本如下:
% Simulation of simple regulation, negative autoregulation and positive
% autoregulation
% Define constants
global a b K n
a = 1;
b = 1;
K = 0.5;
n = 2; % Hill coefficient
% Simulation time
tspan = [0,10];
% Initial condition
X0 = 0;
% Run simulations
[t1,X1] = ode45(@autoregulation_f0,tspan,X0); % Simple regulation
[t2,X2] = ode45(@autoregulation_f1,tspan,X0); % Negative autoregulation
[t3,X3] = ode23(@autoregulation_f2,tspan,X0); % Positive autoregulation
% Plot results
figure;
plot(t1,X1,t2,X2,t3,X3);
legend('simple','negative','Location','southeast');
我的功能是:
function dxdt = autoregulation_f0(t,X)
global a b
dxdt = b - a*X;
end
function dxdt = autoregulation_f1(t,X)
global a b K n
dxdt = b/(1+(X^n)/(K^n)) - a*X;
end
function dxdt = autoregulation_f2(t,X)
global a b K n
dxdt = b*X.^n./(K.^n+X.^n) + a*X;
end
第三个函数“autoregulation_f2(t,X)”是输出零的函数,因此在绘制图形时我只得到一条直线。
有谁知道这可能是什么原因造成的?
提前致谢!
解决方案
它看起来是给定函数的正确结果。您提供的每学期dxdt
都有一个X
。最初的X0=0
结果是dxdt=0
,给你没有变化X
。结果,您最终会得到一条平坦的线。
推荐阅读
- haskell - 提升数据记录类型
- maven - Jenkins 配置文件提供程序插件如何工作?
- scala - 在Scala中的案例类上应用递归操作
- c# - 在身份数据库和主数据库中使用 EF 6 复制表的多个上下文
- html - 对于我们只知道它是由用户上传的图像,适当的 alt 标签是什么?
- javascript - Javascript正则表达式匹配字符串的一部分但不是整个字符串
- flask - Connexion & Flask:在请求处理程序中访问数据库
- package - Chocolatey:升级到新的主要版本时如何处理包的重大变化和卸载?
- sql-server - 在数据流任务中选择 oledb 目标表时出现 SSIS 2012 开发错误
- node.js - passport-github 有时无法读取 id 的属性