Diferencia entre revisiones de «Logistic equation»

De MateWiki
Saltar a: navegación, buscar
 
(No se muestran 38 ediciones intermedias de 2 usuarios)
Línea 1: Línea 1:
Este artículo explica la resolución de la Ecuación logística por el método de Euler.
+
{{ TrabajoED | Ecuación logística. Grupo 6B | [[:Categoría:Ecuaciones Diferenciales|Ecuaciones Diferenciales]]|[[:Categoría:ED15/16|Curso 2015-16]] | Carlos Castro }}
 +
 
 +
[[Archivo:GeM.png|200px|thumb|left|texto alternativo]]
 +
 
 +
This article shows how to solve the logistic equation using the Euler Method.
  
 
== Logistic equation ==
 
== Logistic equation ==
Línea 24: Línea 28:
 
clear all;
 
clear all;
 
t0=0; tN=4;          % initial and final time  
 
t0=0; tN=4;          % initial and final time  
 +
f=@(t,y) y*(1-y);    % define function f(t,y)=y(1-y)
 
y0=1/10;              % value of y at time t=0
 
y0=1/10;              % value of y at time t=0
 
N=40;                % Number of intervals  
 
N=40;                % Number of intervals  
Línea 29: Línea 34:
 
yy=y0;                % yy -> variable with the solution at each time step
 
yy=y0;                % yy -> variable with the solution at each time step
 
y(1)=yy;              % y -> vector where we store the solution
 
y(1)=yy;              % y -> vector where we store the solution
for n=1:N-1
+
for n=1:N  
   yy=yy+h*yy*(1-yy);  % numerical scheme
+
   yy=yy+h*f(t(n),y(n));  % numerical scheme
   y(n+1)=yy;         % store the solution
+
   y(n+1)=yy;             % store the solution in the vector y
 
end  
 
end  
x=t0:h:tN;             % Draw the solution
+
x=t0:h:tN;               % Draw the solution
 
plot(x,y,'x');  
 
plot(x,y,'x');  
 
}}
 
}}
Línea 39: Línea 44:
 
== Results ==
 
== Results ==
  
Consider the particular case: <math> y_0=1/10, \; t_0=0 </math>
+
Consider the particular case: <math> y_0=1/10, \; t_0=0, \; h=1/10 </math>
 
The exact solution can be computed in this case:
 
The exact solution can be computed in this case:
 
<math> y(t)=\frac{e^t}{9+e^t} </math>
 
<math> y(t)=\frac{e^t}{9+e^t} </math>
Línea 46: Línea 51:
 
{|
 
{|
 
|-
 
|-
| [[Archivo:solucion.jpg|thumb|500px|left|Numerical approximation of the solution]] || [[Archivo:error.jpg|thumb|500px|left|Error = abs( exact solution - numerical approximation) |500px]]
+
| [[Archivo:solucion.jpg|thumb|400px|left|Numerical approximation of the solution]] || [[Archivo:error.jpg|thumb|400px|left|Error = abs( exact solution - numerical approximation) |400px]]
 
|}
 
|}
 +
 
--[[Usuario:Carlos Castro|Carlos Castro]] ([[Usuario discusión:Carlos Castro|discusión]]) 15:09 31 ene 2013 (CET)
 
--[[Usuario:Carlos Castro|Carlos Castro]] ([[Usuario discusión:Carlos Castro|discusión]]) 15:09 31 ene 2013 (CET)
 +
 +
 +
[[Categoría:Grado en Ingeniería Civil y Territorial]]
 +
[[Categoría:Ecuaciones Diferenciales]]
 +
[[Categoría:Articles in English]]
 +
[[Categoría:Curso ICE]]
 +
[[Categoría:ED13/14]]
 +
[[Categoría:ED14/15]]
 +
[[Categoría:ED15/16]]
 +
[[Categoría:ED16/17]]
 +
[[Categoría:Artículos genéricos de ecuaciones]]

Revisión actual del 10:58 26 sep 2025

Trabajo realizado por estudiantes
Título Ecuación logística. Grupo 6B
Asignatura Ecuaciones Diferenciales
Curso Curso 2015-16
Autores Carlos Castro
Este artículo ha sido escrito por estudiantes como parte de su evaluación en la asignatura


texto alternativo

This article shows how to solve the logistic equation using the Euler Method.

1 Logistic equation

Logistic equation is used to simulate a number of applications. It was first introduced by P.F. Verhulst to simulate population growth. It reads,

[math]y' = y\cdot (1-y), \quad t\in(t_0,\infty) [/math]

[math]y(t_0) = y_0[/math]

Here, t is the time, [math]y(t)[/math] represents the population size and [math]y_0[/math] the population size at initial time [math]t=t_0[/math].

2 Numerical scheme

We propose an Euler explicit method with time step h,

[math] y_0, \; t_0 [/math]

[math]y_{n+1} = y_{n} + h\cdot y_{n}\cdot(1 - y_{n})[/math]

3 MATLAB code

% Euler method to solve the logistic equation y'=y(1-y)
clear all;
t0=0; tN=4;           % initial and final time 
f=@(t,y) y*(1-y);     % define function f(t,y)=y(1-y)
y0=1/10;              % value of y at time t=0
N=40;                 % Number of intervals 
h=(tN-t0)/40;         % Time step h  
yy=y0;                % yy -> variable with the solution at each time step
y(1)=yy;              % y -> vector where we store the solution
for n=1:N 
   yy=yy+h*f(t(n),y(n));  % numerical scheme
   y(n+1)=yy;             % store the solution in the vector y
end 
x=t0:h:tN;                % Draw the solution
plot(x,y,'x');


4 Results

Consider the particular case: [math] y_0=1/10, \; t_0=0, \; h=1/10 [/math] The exact solution can be computed in this case: [math] y(t)=\frac{e^t}{9+e^t} [/math]


Numerical approximation of the solution
Error = abs( exact solution - numerical approximation)

--Carlos Castro (discusión) 15:09 31 ene 2013 (CET)