how to solve the below error

4 vues (au cours des 30 derniers jours)
Dev
Dev le 18 Juin 2018
Commenté : Dev le 18 Juin 2018
Undefined function or variable 'm1'.
Error in repressilator (line 7) y = [m1 p1 m2 p2 m3 p3];
in matlab program function ydot=repressilator(t,y,p) alpha0 = 1; n = 2.0; beta = 5; alpha = 1000; % order of species; y = [m1 p1 m2 p2 m3 p3]; m1 = -y(1) + alpha/(1+y(6)^n) + alpha0; p1 = -beta*(y(2) - y(1)); m2 = -y(3) + alpha/(1+y(2)^n) + alpha0; p2 = -beta*(y(4) - y(3)); m3 = -y(5) + alpha/(1+y(4)^n) + alpha0; p3 = -beta*(y(6) - y(5)); ydot = [m1; p1; m2; p2; m3; p3]; timespan=[0 15]; y0 = [0 1 0 1 0 1]; [t,y] = ode45(@repressilator,timespan,y0); figure() plot(t,y) xlabel('Time') ylabel('Amount') legend('m1','p1','m2','p2','m3','p3','Location','SouthEast') figure() plot(y(:,1), y(:,2)) xlabel('Amount m1') ylabel('Amount p1')

Réponse acceptée

Torsten
Torsten le 18 Juin 2018
function main
timespan=[0 15];
y0 = [0 1 0 1 0 1];
[t,y] = ode45(@repressilator,timespan,y0);
figure()
plot(t,y)
xlabel('Time')
ylabel('Amount')
legend('m1','p1','m2','p2','m3','p3','Location','SouthEast')
figure()
plot(y(:,1), y(:,2))
xlabel('Amount m1')
ylabel('Amount p1')
end
function ydot=repressilator(t,y)
alpha0 = 1;
n = 2.0;
beta = 5;
alpha = 1000;
% order of species;
m1 = -y(1) + alpha/(1+y(6)^n) + alpha0;
p1 = -beta*(y(2) - y(1));
m2 = -y(3) + alpha/(1+y(2)^n) + alpha0;
p2 = -beta*(y(4) - y(3));
m3 = -y(5) + alpha/(1+y(4)^n) + alpha0;
p3 = -beta*(y(6) - y(5));
ydot = [m1; p1; m2; p2; m3; p3];
end
  1 commentaire
Dev
Dev le 18 Juin 2018
HOW TO SOLVE THE BELOW ERROR Undefined function or variable 'repressilatorddt'.
Error in odearguments (line 90) f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0.
Error in ode45 (line 115) odearguments(FcnHandlesUsed, solver_name, ode, tspan, y0, options, varargin);
Error in repressilatorr (line 31) [t,s]=ode45(ODEFUN, [0,Tend], x0, options);
IN PROGRAM %file repressilator.m %Model of repressilator oscillatory genetic circuit %from Elowitz and Leibler (2000) Nature 403, pp 335-338. %Figure 7.21
function repressilatorr
clear all
%declare model parameters global alpha global alpha0 global n global beta
%assign parameter values alpha0=60*(5e-4); %transcripts/sec alpha=60*(5-alpha0); %transcripts/sec n=2; beta=1/5;
%set simulation parameters Tend=1000 ODEFUN=@repressilatorddt; options=odeset('Refine', 6);
%set initial condition: state = [m1 p1 m2 p2 m3 p3] x0=[0.2 0.1, 0.3 0.1 0.4 0.5]';
%run simulation [t,s]=ode45(ODEFUN, [0,Tend], x0, options);
%produce figure 7.21A figure(1) set(gca,'fontsize',14) t=t/0.3485 plot(t,40*s(:,2), 'k',t,40*s(:,4), 'k--', t,40*s(:,6), 'k:','Linewidth', 3) axis([0 800 0 7000]) ylabel('protein abundance (molecules per cell)') xlabel('Time (min)') legend('Protein 1', 'Protein 2', 'Protein 3')

Connectez-vous pour commenter.

Plus de réponses (1)

Ankita Bansal
Ankita Bansal le 18 Juin 2018
Hi DEVI, are you trying to run this example?
You have written ODEFUN=@repressilatorddt; but you have not defined repressilatorddt.
You can modify your code to
function repressilatorr
clear all
%declare model parameters
global alpha
global alpha0
global n
global beta
%assign parameter values
alpha0=60*(5e-4); %transcripts/sec
alpha=60*(5-alpha0); %transcripts/sec
n=2;
beta=1/5;
%set simulation parameters
Tend=1000
ODEFUN=@repressilatorddt;
options=odeset('Refine', 6);
%set initial condition: state = [m1 p1 m2 p2 m3 p3]
x0=[0.2 0.1, 0.3 0.1 0.4 0.5]';
%run simulation
[t,s]=ode45(ODEFUN, [0,Tend], x0, options);
%produce figure 7.21A
figure(1)
set(gca,'fontsize',14)
t=t/0.3485
plot(t,40*s(:,2), 'k',t,40*s(:,4), 'k--', t,40*s(:,6), 'k:','Linewidth', 3)
axis([0 800 0 7000])
ylabel('protein abundance (molecules per cell)')
xlabel('Time (min)')
legend('Protein 1', 'Protein 2', 'Protein 3')
end
function dS=repressilatorddt(t,s)
global alpha
global alpha0
global n
global beta
m1=s(1);
p1=s(2);
m2=s(3);
p2=s(4);
m3=s(5);
p3=s(6);
m1ddt= alpha0 + alpha/(1+p3^n) - m1;
p1ddt=beta*(m1-p1);
m2ddt= alpha0 + alpha/(1+p1^n) - m2;
p2ddt=beta*(m2-p2);
m3ddt= alpha0 + alpha/(1+p2^n) - m3;
p3ddt=beta*(m3-p3);
dS =[m1ddt, p1ddt, m2ddt, p2ddt, m3ddt, p3ddt]';
end
  1 commentaire
Dev
Dev le 18 Juin 2018
thanks for the reply..i gt d op

Connectez-vous pour commenter.

Catégories

En savoir plus sur Genomics and Next Generation Sequencing dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by