Diferencia entre revisiones de «Logistic equation»
De MateWiki
| 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. | |
| − | + | ||
| + | == Logistic equation == | ||
<math>y_0 = f(t,y) = y\cdot (1-y)</math> | <math>y_0 = f(t,y) = y\cdot (1-y)</math> | ||
| Línea 6: | Línea 7: | ||
<math>y(t_0) = y_0</math> | <math>y(t_0) = y_0</math> | ||
| − | + | == Numerical scheme == | |
<math> y(0) = 1/10</math> | <math> y(0) = 1/10</math> | ||
| Línea 12: | Línea 13: | ||
<math>y(n+1) = y(n) + h\cdot y(n)\cdot(1 - y(n))</math> | <math>y(n+1) = y(n) + h\cdot y(n)\cdot(1 - y(n))</math> | ||
| − | + | == MATLAB code == | |
{{matlab|codigo= | {{matlab|codigo= | ||
% Euler method to solve the logistic equation y'=y(1-y) | % Euler method to solve the logistic equation y'=y(1-y) | ||
| Línea 29: | Línea 30: | ||
plot(x,y,'x'); | plot(x,y,'x'); | ||
}} | }} | ||
| + | |||
| + | == Resultados == | ||
| + | |||
{| | {| | ||
|- | |- | ||
| [[Archivo:solucion.jpg|thumb|500px|left|Aproximación numérica]] || [[Archivo:error.jpg|thumb|500px|left|Error entre la solución exacta y la aproximación numérica|500px]] | | [[Archivo:solucion.jpg|thumb|500px|left|Aproximación numérica]] || [[Archivo:error.jpg|thumb|500px|left|Error entre la solución exacta y la aproximación numérica|500px]] | ||
|} | |} | ||
Revisión del 13:52 31 ene 2013
Este artículo explica la resolución de la Ecuación logística por el método de Euler.
1 Logistic equation
[math]y_0 = f(t,y) = y\cdot (1-y)[/math]
[math]y(t_0) = y_0[/math]
2 Numerical scheme
[math] y(0) = 1/10[/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
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-1
yy=yy+h*yy*(1-yy); % numerical scheme
y(n+1)=yy; % store the solution
end
x=t0:h:tN; % Draw the solution
plot(x,y,'x');