Need help with Matlab Function of Differential Equations

AI Thread Summary
The user is attempting to model a Protein G example using a MATLAB function for differential equations but is facing issues with the output graphics not matching the expected results. The function and script provided contain potential errors, including the handling of variables and the use of negative signs. Suggestions include using breakpoints for debugging and adjusting initial conditions and parameter values to achieve better results. The discussion emphasizes the importance of clarity in variable correspondence and the need for proper code formatting for better readability.
Dionisio Mendoza
Messages
9
Reaction score
0
Homework Statement
I am trying to imitate a model of differential equations in Matlab about G proteins but I can not achieve it.
Relevant Equations
-d/dt=x2
d/dt=x1
WHAT HAPPENS IS That I need to model the example of A Protein G example, using a function f in Matlab, but when I execute the script, the graphics I get do not correspond to those of the example.
The problem is that I can not understand what the model seeks to represent, besides that I do not know if my script is correct.
The function is the following:
Matlab:
function dydx = examenisb (x,y)

ki = 1;
ku = 1;
global Km1;
global Km2;

V1 = y(2)*ki*x(1)/(Km1+y(2));
V2 = y(1)*ku*x(1)/(Km2+y(1));dadx = V1-V2;
dbdx = -V1-V2;
dydx = [dadx -dbdx]';

The scrypt is this:

global Km1;
global Km2;
Km1=.001;
Km2=.001;
[x,y]=ode45(@examenisb,[0,2],[0.1 0.1]);
plot(x,y);

xlabel('tiempo (h)')
ylabel('biomasa')
title('Biomasa')

The section of the PDF is that of 3.2.4.1 G proteins

[Mentor Note -- Added code tags. Please always post code using code tags]
 

Attachments

Last edited by a moderator:
Physics news on Phys.org
Hello,

Not an expert, but I tried your function and it does something (at least in Octave).

If this is the same picture you get (which you did not post -- why not ?), it isn't corresponding to the example (which you did not post -- why not ?)
243504


Do we have to guess which variable in the example corresponds to which variable in your script ?

Do you know how to work with break points to check what is going on ?

I notice you do v2=-... and then dydx = - ... minus sign twice ?

Note: your post looks a lot better when enclosed in ##[##code=matlab##]## ... ##[##/code##]##

Matlab:
function dydx = examenisb (x,y)

ki = 1;
ku = 1;
global Km1;
global Km2;

V1 = y(2)*ki*x(1)/(Km1+y(2));
V2 = y(1)*ku*x(1)/(Km2+y(1));dadx = V1-V2;
dbdx = -V1-V2;
dydx = [dadx -dbdx]';

The scrypt is this:

global Km1;
global Km2;
Km1=.001;
Km2=.001;
[x,y]=ode45(@examenisb,[0,2],[0.1 0.1]);
plot(x,y);

xlabel('tiempo (h)')
ylabel('biomasa')
title('Biomasa') [/
 
Ah, I see: you want something like fig 3.13 (b) ?

Your values now are such that V1 = V2 so one derivative is 0 and stays 0.
The other is so small I suspect a scale error (units?)

With y0 =[0 1] instead of [0.1 0.1] :
Matlab:
[x,y]=ode45(@dydx,[0,2],[0 1]);

% and 

function dydx = examenisb (x,y)

ki = 1000;
ku = 1000;
global Km1;
global Km2;

V1 = y(2)*ki*x(1)/(Km1+y(2));
V2 = y(1)*ku*x(1)/(Km2+y(1));dadx = V1-V2;
dbdx = -V1+V2;
dydx = [dadx dbdx]';
I get
243507


Looks better eh ?
 
BvU said:
Hello,

Not an expert, but I tried your function and it does something (at least in Octave).

If this is the same picture you get (which you did not post -- why not ?), it isn't corresponding to the example (which you did not post -- why not ?)
View attachment 243504

Do we have to guess which variable in the example corresponds to which variable in your script ?

Do you know how to work with break points to check what is going on ?

I notice you do v2=-... and then dydx = - ... minus sign twice ?

Note: your post looks a lot better when enclosed in ##[##code=matlab##]## ... ##[##/code##]##

Matlab:
function dydx = examenisb (x,y)

ki = 1;
ku = 1;
global Km1;
global Km2;

V1 = y(2)*ki*x(1)/(Km1+y(2));
V2 = y(1)*ku*x(1)/(Km2+y(1));dadx = V1-V2;
dbdx = -V1-V2;
dydx = [dadx -dbdx]';

The scrypt is this:

global Km1;
global Km2;
Km1=.001;
Km2=.001;
[x,y]=ode45(@examenisb,[0,2],[0.1 0.1]);
plot(x,y);

xlabel('tiempo (h)')
ylabel('biomasa')
title('Biomasa') [/
THIS GRAPH
 

Attachments

  • Captura.PNG
    Captura.PNG
    6.2 KB · Views: 426
Back
Top