METODO DE LA BISECCION CON EJEMPLOS

GENERALIZACIÓN
% Método de la Bisección
function raiz=biseccion(fdex1,i,s)
error=0.01;
j=1;
fa=feval(fdex1,i);
fb=feval(fdex1,s);
r = (i+s)/2;
fr = feval(fdex1,r);
if fa*fb < 0
ep = 100;
ant=0;
fprintf(' i r s f(i) f(r) f(s) ep \n')
fprintf('-----------------------------------------------------------------------------------\n')
while abs(fr) > error

fa=feval(fdex1,i);
fb=feval(fdex1,s);
r = (i+s)/2;
fr = feval(fdex1,r);
fab = fa * fr;
ep = abs((r - ant) / r) *100;

fprintf('%5d %10.6f %10.6f %10.6f %10.6f %10.6f %10.6f %10.6f \n',j,i,r,s,fa,fr,fb,ep);
ant=r;
j=j+1;

if fa*fr<0
s=r;
else
i=r;
end
end
else
fprintf('Cambiar limites ');
end %End function

NOTA : EL GENERICO FUNCIONA PARA LOS DOS EJERCICIOS.

EJEMPLO 1
% Función: f(x) = X 4 - 2 X 3 - 12 X 2 + 16 X - 40
function y = fdex(x)
y= exp(-x^3)-2*x+1; con intervalo de 0.75 a 1

EJEMPLO 2
% Función: f(x) = X 4 - 2 X 3 - 12 X 2 + 16 X - 40
function y = fdex(x)
y= ((x^2)+1)^(1/2)-tan(x); con intervalo de 0.5 a 1



  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

METODO DE LA REGLA FALSA CON EJEMPLOS

//GENÉRICO
% Método de la Bisección
function raiz=biseccion(fdex2,i,s,error)
%error=0.01;
j=1;
fa=feval(fdex2,i);
fb=feval(fdex2,s);
r = (((i*fb)-(s*fa))/(fb-fa));
fr = feval(fdex2,r);
if fa*fb < 0
ep = 100;
ant=0;
fprintf(' i r s f(i) f(r) f(s) ep \n')
fprintf('----------------------------------------------------------------------------------\n')
while abs(fr) > error

fa=feval(fdex2,i);
fb=feval(fdex2,s);
r = (((i*fb)-(s*fa))/(fb-fa));
fr = feval(fdex2,r);
fab = fa * fr;
ep = abs((r - ant) / r) *100;

fprintf('%5d %10.6f %10.6f %10.6f %10.6f %10.6f %10.6f %10.6f \n',j,i,r,s,fa,fr,fb,ep);
ant=r;
j=j+1;

if fa*fr<0
s=r;
else
i=r;
end
end
else
fprintf('Cambiar limites ');
end %End function

NOTA : EL GENERICO FUNCIONA PARA LOS DOS EJEMPLOS SIGUIENTES.


//Ecuación 1
% Función: f(x) = X 4 - 2 X 3 - 12 X 2 + 16 X - 40
function y = fdex(x)
y= atan(x)+x-1;
//Ecuación 2
% Función: f(x) = X 4 - 2 X 3 - 12 X 2 + 16 X - 40
function y = fdex(x)
y= tan(x)-x-0.5;


  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

OTROS TIPOS DE RAICES DE ECUACIONES















































  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Tutorial MatLab

Hola, Aqui les dejo un tutorial sobre MatLab bastante completo y lo bueno es que son tutoriales en video asi que no tendran problemas en aprender.


Tutorial MatLab Parte 1



En breve estare agregando las partes que siguen en este interesante tutorial.
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Convertir decimal ha binario Matlab

Este es un metodo que convierte de decimal ha binario en matlab

Pueden Probar este metodo:

dec2bin

str = dec2bin(d)
str = dec2bin(d,n)

Description

returns the
str = dec2bin(d) binary representation of d as a string. d must be a nonnegative integer smaller than 2^52.
str = dec2bin(d,n) produces a binary representation with at least n bits.

Examples

Decimal 23 converts to binary 010111:dec2bin(23)ans =
10111
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Convertir dec2bin

para la conversion de decimal a binario:

dec2bin(int y)

halla el binario de y...

gabriela
  • Digg
  • Del.icio.us
  • StumbleUpon
  • Reddit
  • Twitter
  • RSS

Buscar en este blog