Monday, February 23, 2009

Shop Schwarzkopf Hair Color Walmart

euler method (ec diff. Ordinary) Implemented in Matlab

Here you have the main code of a program implemented in Matlab some friends and I to hand in to the enlargement of mathematics. This is a program that calculates and draws the exact and approximate solutions to differential equations given were analyzed using the iterative method of Euler. I hope you like, ask me euler.m files and funcion1.m

% Sample numerical solution a system of ordinary differential equations
% by the method of Euler. Requires euler.my funcion1.m
%.
% Fixed
initial conditions a = 0;
b = 1;
and a = 1;
M = 5;
h = (ba) / M;
x = zeros (M +1);
y = zeros ( M +1);
z = zeros (2 * M +2);
z = euler ('Function1', a, b, and, M);
x = z (1: M +1);
y = z (M +2:2 * M +2);
e = exp (x) shows the results
%
fprintf ('\\ n \\ n Euler method applied to the equation: \\ n');
fprintf ( '\\ n dy / dx = y (0) = 1 \\ n \\ n for h =');
fprintf ('% 4.4f \\ n \\ n', h);
fprintf ('x and y exact error \\ n') fprintf
('---------------------------------- ----------- \\ n ');
fprintf ('% 6.2f% 12.8f% 12.8f% 12.8f \\ n ', [x, y, e, and e-y]);
fprintf ('--------------------------------------------- \\ n ');
x = a: h/100: b;
e = exp (x);
plot (x, y,' +-b ', xe, ye,' k ')
title (' Euler Method for y''= y, y (0) = 1 with h = 0.2 h = 0.1 ');
hold;
pause;
M = 2 * M;
h = (ba) / M;
x = zeros ( M +1);
y = zeros (M +1);
z = zeros (2 * M +2);
z = euler ('Function1', a, b, and, M);
x = z ( 1: M +1);
y = z (M +2:2 * M +2);
e = exp (x) shows the results
%
fprintf ('\\ n \\ n Euler method applied to the equation: \\ n');
fprintf ('\\ n dy / dx = y (0) = 1 \\ n \\ n for h =');
fprintf ('% 4.4f \\ n \\ n', h);
fprintf ('x and y exact error \\ n ') fprintf
('------------------------------------------ --- \\ n ');
fprintf ('% 6.2f% 12.8f% 12.8f% 12.8f \\ n ', [x, y, e, and e-y]) fprintf
('----- ---------------------------------------- \\ n ');
plot (x, y, '+-r')

certainly gave us 8 out of 10, a few tenths in addition to the exam.

0 comments:

Post a Comment