Need help with Matlab Function of Differential Equations

In summary: IC DOES NOT CORRESPOND TO THAT OF THE EXAMPLEIn summary, the graphic I get does not correspond to that of the example. I am not sure if my script is correct.
  • #1
Dionisio Mendoza
9
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

  • Systems-Biology4.pdf
    88.2 KB · Views: 260
Last edited by a moderator:
Physics news on Phys.org
  • #2
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') [/
 
  • #3
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 ?
 
  • #4
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: 393

FAQ: Need help with Matlab Function of Differential Equations

What is a differential equation?

A differential equation is a mathematical equation that describes the relationship between a function and its derivatives. It is used to model various physical and natural phenomena, such as motion, growth, and decay.

How is Matlab used to solve differential equations?

Matlab has built-in functions and tools for solving differential equations, such as the "ode45" function. It uses numerical methods to approximate the solution to the differential equation.

What are the steps for solving a differential equation in Matlab?

The general steps for solving a differential equation in Matlab are: 1) Define the differential equation using the "odefun" function, 2) Set initial conditions, 3) Use the "ode45" function to solve the equation, 4) Plot the solution using the "plot" function.

Can Matlab solve any type of differential equation?

No, Matlab can only solve ordinary differential equations (ODEs). It cannot solve partial differential equations (PDEs) or stochastic differential equations (SDEs).

Are there any limitations to using Matlab for solving differential equations?

One limitation of using Matlab for solving differential equations is that it can only provide numerical solutions, not exact solutions. Also, the accuracy of the solution depends on the chosen numerical method and step size.

Similar threads

Back
Top