马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?我要加入
x
在模型中
IKK 从0.09-9变化 oed_a 中储存了对应变化的数值, oed_a中各个数值不等,我用断点检测了前十个 结果大致如下
1.0e+021*(2.68 4.48 3.80 3.88 0.21 0.22 0.52 1.69 0.17 0.15)
于是命令plot(IKK, oed_a, r-)
可为什么画出来的线是直线 或直接看不见,oed_d, oed_e,oed_me情况一样 是不是编程问题??如果是, 应该怎么改! 谢谢您的帮助!
具体编程如下:- clear all
- clc;
- format long;
- IKK_normal=0.9;% initional value of N
- for KN=1:100
-
- IKK=IKK_normal*KN/10;
- Xinit=[1.5e-5 0 0 0 0 0.8 0 IKK 0 0]';
- k=[100000 1000 100 10000 50000 200 1000 20000 5000 100 500]';
- sys = mdlInit(@ODESenfun, k , Xinit, zeros(11,10));
- Tspan = 0:60:6000;
- smltn = smltnInit(@ode15s, Tspan);
- n = length(Xinit);
- m = length(k);
- [t, X, S3] = mdlPlay(sys, smltn);
- S2 = S2DParam(S3);
-
- FIM=S2'*S2;
- [vec, lam]=eig(FIM);
- for j=1:11
- lambda(j)=lam(j,j);
- end
- %############################optimal##############
- oed_a(KN)=trace(inv(FIM));
- oed_d(KN)=det(FIM);
- oed_e(KN)=min(lambda);
- oed_me(KN)=max(lambda)/min(lambda);
- %########PLOTING########
-
- end
- figure
- plot(IKK,oed_a,'r-');
- hold on;
- [a,b]=min(oed_a);
- IKK1=b/10*IKK_normal*ones(size(oed_a));
- plot(IKK1,oed_a,'b--');
- text(0.1,2e-3,['IKK=' num2str(b/10*IKK_normal) '\muM']);
- xlabel('Initial concentration of IKK (\muM)');
- ylabel('Trace(FIM^-^1)');
- legend('A-optimal criterion');
-
- figure
- plot(IKK,oed_d,'r-');
- hold on;
- [a,b]=max(oed_d);
- IKK1=b/10*IKK_normal*ones(size(oed_d));
- plot(IKK1,oed_d,'b--');
- text(0.1,10e25,['IKK=' num2str(b/10*IKK_normal) '\muM']);
- xlabel('Initial concentration of IKK (\muM)');
- ylabel('Det(FIM)');
- legend('D-optimal criterion');
-
- figure
- plot(IKK,oed_e,'r-');
- hold on;
- [a,b]=max(oed_e);
- IKK1=b/10*IKK_normal*ones(size(oed_e));
- plot(IKK1,oed_e,'b--');
- text(0.1,5e6,['IKK=' num2str(b/10*IKK_normal) '\muM']);
- xlabel('Initial concentration of IKK (\muM)');
- ylabel('\lambda_m_i_n(FIM)');
- legend('E-optimal criterion');
-
- figure
- plot(IKK,oed_me,'r-');
- hold on;
- [a,b]=min(oed_me);
- IKK1=b/10*IKK_normal*ones(size(oed_me));
- plot(IKK1,oed_me,'b--');
- text(0.1,8e5,['IKK=' num2str(b/10*IKK_normal) '\muM']);
- xlabel('Initial concentration of IKK (\muM)');
- ylabel('\lambda_m_a_x(FIM)/\lambda_m_i_n(FIM)');
- legend('modified E-optimal criterion');
复制代码 相关子程序:(以下保证正确)- function mdl = mdlInit(ode, theta, x_init, S_init)
- % MDLINIT Initialise the parameters used in the model
- % Validate input/output arguments
- if nargin~=4
- error('Function requires 4 input arguments');
- end
- % Initialise model data structure
- mdl.ode = ode;
- mdl.theta = theta;
- mdl.x_init = x_init;
- mdl.S_init = S_init;
- mdl.thetaAeq = [];
- mdl.thetaBeq = [];
复制代码- function [t, X, S] = mdlPlay(mdl, smltn)
- % MDLPLAY Simulate the model over the time span
- %
- % Returns the simulated states and the sensitivity matrix
- %
- % [t, X, S] = mdlPlay(mdl, smltn)
- % mdl model data structure
- % smltn simulation data structure
- % X 2D matrix i,j (states, time) NB this is the transpose of normal
- % return from the solver
- % S 3D matrix i,j,k (states, parameters, time)
- % Validate the input/output arguments
- if nargin~=2,
- error('Two input arguments are required');
- end
- if nargout<2 || nargout>3
- error('Two or three output arguments are required');
- end
- % Initialise the parameters
- num_states = length(mdl.x_init);
- num_param = length(mdl.theta);
- % Reshape the initial parameter/sensitivity values for the ODE simulation)
- xs_init = [mdl.x_init; reshape(mdl.S_init, num_states*num_param, 1)];
- % Run the ODE simulation
- [t, X_S] = feval(smltn.solver, mdl.ode, smltn.tspan, xs_init, [], mdl.theta);
- num_time = length(t);
- % Reshape the state matrix (states, time)
- X = X_S(:,1:num_states)';
- % Reshape the sensitivity derivatives (states, parameters, time)
- if nargout==3,
- S = reshape(X_S(:,num_states+1:end)', num_states, num_param, num_time);
- end
-
复制代码- function dx = ODESenfun(t, x, k)
- % ODESENFUN Solve both system dynamic ODEs and Sensitivity Equations
- % System Dynamic ODEs
- % x_dot = F*theta
- % S_dot = J*S + F
- % Check input and output arguments are correctly supplied
- if nargin~=3
- error('Three input arguments are required');
- end
- numStates = 10;
- numPara = 11;
- % Calculate the state derivatives
- % Need to investigate a way to automatically generate these quantities (from a symbolic model)
- %dx(1)=-k1*x(1)*x(6)+km1*x(2)+k4*x(4)-km4*x(1)*x(9)+k6*x(5);
- %dx(2)=k1*x(1)*x(6) - km1*x(2) - k2*x(2) + km2*x(3)*x(7);
- %dx(3)=k2*x(2) - km2*x(3)*x(7) - k3*x(3)*x(8) + km3*x(4) - k5W*x(3) + km5*x(5);
- %dx(4)=k3*x(3)*x(8) - km3*x(4) - k4*x(4) + km4*x(1)*x(9);
- %dx(5)=k5W*x(3) - km5*x(5) - k6*x(5);
- %dx(6)=-k1*x(1)*x(6) + km1*x(2);
- %dx(7)=k2*x(2) - km2*x(3)*x(7);
- %dx(8)=-k3*x(3)*x(8) + km3*x(4);
- %dx(9)=k4*x(4) - km4*x(1)*x(9);
- %dx(10)=k6*x(5);
- F = [-x(1)*x(6) x(2) 0 0 0 0 x(4) -x(1)*x(9) 0 0 x(5);
- x(1)*x(6) -x(2) -x(2) x(3)*x(7) 0 0 0 0 0 0 0;
- 0 0 x(2) -x(3)*x(7) -x(3)*x(8) x(4) 0 0 -x(3) x(5) 0;
- 0 0 0 0 x(3)*x(8) -x(4) -x(4) x(1)*x(9) 0 0 0;
- 0 0 0 0 0 0 0 0 x(3) -x(5) -x(5);
- -x(1)*x(6) x(2) 0 0 0 0 0 0 0 0 0;
- 0 0 x(2) -x(3)*x(7) 0 0 0 0 0 0 0;
- 0 0 0 0 -x(3)*x(8) x(4) 0 0 0 0 0;
- 0 0 0 0 0 0 x(4) -x(1)*x(9) 0 0 0;
- 0 0 0 0 0 0 0 0 0 0 x(5);];
- dx = F*k;
- % Calculate the sensitivity derivatives
- % Need to investigate a way to automatically differentiate these quantities (from a symbolic model)
- S = reshape(x(numStates+1:end), numStates, numPara);
- J = [-k(1)*x(6)-k(8)*x(9) k(2) 0 k(7) k(11) -k(1)*x(1) 0 0 -k(8)*x(1) 0;
- k(1)*x(6) -k(2)-k(3) k(4)*x(7) 0 0 k(1)*x(1) k(4)*x(3) 0 0 0;
- 0 k(3) -k(4)*x(7)-k(5)*x(8)-k(9) k(6) k(10) 0 -k(4)*x(3) -k(5)*x(3) 0 0;
- k(8)*x(9) 0 k(5)*x(8) -k(6)-k(7) 0 0 0 k(5)*x(3) k(8)*x(1) 0;
- 0 0 k(9) 0 -k(10)-k(11) 0 0 0 0 0;
- -k(1)*x(6) k(2) 0 0 0 -k(1)*x(1) 0 0 0 0;
- 0 k(3) -k(4)*x(7) 0 0 0 -k(4)*x(3) 0 0 0;
- 0 0 -k(5)*x(8) k(6) 0 0 0 -k(5)*x(3) 0 0;
- -k(8)*x(9) 0 0 k(7) 0 0 0 0 -k(8)*x(1) 0;
- 0 0 0 0 k(11) 0 0 0 0 0;];
-
- dS = J*S+F;
- dx((numStates+1):(numStates*(numPara+1))) = reshape(dS,numStates*numPara,1);
复制代码- function S1 = S2DParam(S)
- % S2DPARAM Reshape the sensitivity matrix, S, to a 2D matrix
- % S - 3D matrix (states, param, time)
- % S1 - 2D matrix (states*time, param)
- S1 = zeros(size(S,1)*size(S,3), size(S,2));
- num_states = size(S,1);
- num_time = size(S,3);
- for i=1:num_states
- S1((i-1)*num_time+1:i*num_time, :) = shiftdim(S(i, :, :),1)';
- end
复制代码- function smltn = smltnInit(solver, tspan)
- % Initialize the parameters used in the ODE simulation
- % Validate the input/output arguments
- if nargin~=2
- error('2 input arguments must be supplied');
- end
- % Set the data structure's fields
- smltn.solver = solver;
- smltn.tspan = tspan;
复制代码 如果你有时间 不妨帮我看下, 在此我衷心感谢您的帮助与参与!! |