Need help with Matlab Function of Differential Equations

Click For Summary

Discussion Overview

The discussion revolves around modeling a protein G example using a MATLAB function for differential equations. Participants are trying to understand the discrepancies between the expected graphical output and what is produced by the script. The conversation includes aspects of coding, debugging, and the biological interpretation of the model.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Mathematical reasoning

Main Points Raised

  • One participant expresses confusion about the model's representation and the correctness of their MATLAB script.
  • Another participant questions the absence of the expected output and suggests that the original example and the output should be shared for clarity.
  • Concerns are raised regarding the use of double negative signs in the derivative calculations, which may lead to confusion.
  • A suggestion is made to change initial conditions from [0.1 0.1] to [0 1] to potentially improve the output.
  • One participant proposes that the parameters ki and ku might need adjustment, indicating that the current values lead to one derivative being zero and the other being very small.
  • There is a mention of using breakpoints for debugging to understand the function's behavior better.

Areas of Agreement / Disagreement

Participants do not reach a consensus on the correct approach or output. Multiple competing views and suggestions remain regarding the model parameters and initial conditions.

Contextual Notes

There are unresolved questions about the definitions of variables in the original example and how they correspond to those in the script. The discussion also highlights potential scale errors and the need for clarity in the model's representation.

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: 464

Similar threads

  • · Replies 10 ·
Replies
10
Views
2K
Replies
2
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 8 ·
Replies
8
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 4 ·
Replies
4
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 1 ·
Replies
1
Views
2K