Documentos de Académico
Documentos de Profesional
Documentos de Cultura
clear all
disp('METODO DE EULER')
clc
syms x
syms y
f=inline(input('ingrese la derivada:','s'));
x=input('ingrese el valor de x:');
y=input('ingrese el valor de y:');
h=input('ingrese el valor de h:');
n=input('ingrese numero de iteraciones:');
clc
disp('x(n) y(n) y(n) hy(n)');
for i=1:n
y1=feval(f,x,y);
hy1=h*y1;
fprintf('\n%0.1f %0.4f %0.4f %0.4f ',x,y,y1,hy1);
y=y+hy1;
x=x+h;
end
METODO DE NEWTON-COTES
clc
clear all
disp('METODO DE NEWTON-COTES')
syms x
f=inline(input('ingrese la funcion:','s'));
a=input('ingrese intervalo inferior:');
b=input('ingrese intervalo superior:');
n=1
h=(b-a)/3
x0=a
x1=x0+h
x2=x1+h
x3=x2+h
x4=x3+h
f0=feval(f,x0)
f1=feval(f,x1)
f2=feval(f,x2)
f3=feval(f,x3)
f4=feval(f,x4)
I1=(h/2)*(f0+f1)
error=(-1/12)*(h^5)*((f2-(2*f1)+f0)/(h^2))
I1=I1+error
n=2
I2=(h/3)*(f0+4*f1+f2)
error=(-1/90)*(h^5)*((f4-(4*f3)+(6*f2)-(4*f1)+f0)/(h^4))
I2=I2+error
disp('x(n) k1 k2 k3 k4 ');
for i=1:n
k1=h*(feval(f,x,y));
z=x+(1/2*(h));
w=y+(1/2*(k1));
k2=h*(feval(f,z,w));
w=y+(1/2*(k2));
k3=h*(feval(f,z,w));
z=x+h;
w=y+k3;
k4=h*(feval(f,z,w));
fprintf('\n%0.1f %0.4f %0.4f %0.4f %0.4f %0.4f',x,y,k1,k2,k3,k4);
x=x+h;
y=y+((1/6)*(k1+2*k2+2*k3+k4));
end
METODO DE BAIRSTOW
clc
tol=10^-3;
x1=input('ingrese x1:');
x2=input('ingrese x2:');
x3=input('ingrese x3:');
x4=input('ingrese x4:');
x5=input('ingrese x5:');
r=input('ingrese r:');
s=input('ingrese s:');
b1=1;b0=1;
while(abs(b1>tol) & abs(b0>tol))
b4=x1;
b3=(b4*r)+x2;
b2=(b3*r)+(b4*s)+x3;
b1=(b2*r)+(b3*s)+x4;
b0=(b1*r)+(b2*s)+x5;
c4=b4;
c3=(c4*r)+b3;
c2=(c3*r)+(c4*s)+b2;
c1=(c2*r)+(c3*s)+b1;
dr=((-b1*c2)-(-b0*c3))/((c2*c2)-(c1*c3));
ds=((c2*-b0)-(c1*-b1))/((c2*c2)-(c1*c3));
r=dr+r;
s=ds+s;
end
p=-r;
q=-s;
fprintf('POLINOMIO = %0.0fX^4 +%0.2fX^3 + %0.2fX^2 + %0.2fX
+%0.2f\n',x1,x2,x3,x4,x5);
fprintf('LA FORMA BUSCADA ES \n(%0.0fX^2 + %0.1fX + %0.2f) Y %0.0fX^2 +
%0.1fX + %0.2f',b4,b3,b2,x1,p,q);
I3=I3+error
Enlaces a esta entrada
Crear un enlace
Entrada ms reciente Entrada antigua Pgina principal
contador