Professional Documents
Culture Documents
at line 2
at line 2
at line 2
at line 2
% METODO DE BIPARTICION
% Function [x,e,tol]=bipart(F,a,b,n)
% F= nombre de la funcion a resolver
% a= extremo inferior del intervalo inicial
% b=
"
superior "
"
"
% n= numero de iteraciones
% x= solucion devuelta
% e= condicion de error(e=0, correcto. e=1, intervalo inicial incorrecto)
% tol= cota de |x'-x| (x'=solucion aproximada, x=solucion verdadera)
function [x,e,tol]=bipart(F,a,b,n)
FA=feval(F,a);FB=feval(F,b);x=(a+b)/2;FX=feval(F,x);e=0;
if FA*FB>0,e=1,break,end
if FA==0,x=a,break,end
if FB==0,x=b,break,end
% Iteraciones
for k=1:n
FX=feval(F,x);if FX==0,break,end
if FA*FX<0,
b=x;FB=feval(F,b);
else
a=x;FA=feval(F,a);
end
x=(a+b)/2;
end
tol=(b-a)/2;
edit bipart
fschange('C:\Documents and Settings\matap.AULA\Mis documentos\bipart.m');
clear bipart
type bipart
%
%
%
%
%
%
METODO DE BIPARTICION
Function [x,e,tol]=bipart(F,a,b,n)
F= nombre de la funcion a resolver
a= extremo inferior del intervalo inicial
b=
"
superior "
"
"
n= numero de iteraciones
Pgina 1 de 20
0;
-1;
6*z.^2-4];
type newton2
function [z,e]=newton2(F,J,x0,n)
% F = sistema a resolver
% J = jacobiano
% x0 = punto inicial
Pgina 6 de 20
en [0,3]^T ?
en [0,3]^T ?
LU factorization.
[L,U] = LU(X) stores an upper triangular matrix in U and a
"psychologically lower triangular matrix" (i.e. a product
of lower triangular and permutation matrices) in L, so
that X = L*U. X can be rectangular.
[L,U,P] = LU(X) returns lower triangular matrix L, upper
triangular matrix U, and permutation matrix P so that
P*X = L*U.
Pgina 13 de 20
doolittle.m
f4p3.m
f5p3.m
gauss.m
gaussjor.m
gausspar.m
gausstot.m
jf4p3.m
metpoten.m
newton2.M
p3_1.m
Size
Bytes
10x10
10x1
800
80
p3_4.m
p3_5.m
p3_6.m
practica_3.zip
sistema.m
sistema2.m
sistemasobre.m
solqr.m
sustprog.m
sustreg.m
Class
double array
double array
5x5
5x1
200
40
double array
double array
0.00281499338042
0.70902901198165
-0.31980926522185
-0.48326356559803
0.40180629166842
0.51209155649919
0.20483662259968
-0.03413943709995
-0.20483662259968
-0.30725493389951
-0.34139437099946
-0.30725493389951
-0.20483662259968
-0.03413943709995
0.20483662259968
0.51209155649919
-1.65831239517770
1.04880884817015
0
-1.16081867662439
1.04880884817015
0.29291637031754
norm(aEN)
|| M ||_2
por
|| pinv(M) ||_2
Pgina 20 de 20
or
3
y = [x
2
x
1] [p3
p2
p1
p0]
if ~isequal(size(x),size(y))
error('X and Y vectors must be the same size.')
end
x = x(:);
y = y(:);
if nargout > 2
mu = [mean(x); std(x)];
x = (x - mu(1))/mu(2);
end
% Construct Vandermonde matrix.
V(:,n+1) = ones(length(x),1);
for j = n:-1:1
V(:,j) = x.*V(:,j+1);
end
% Solve least squares problem, and save the Cholesky factor.
Pgina 2 de 14
For a
0.1090
pause
% Apartado c: Estimacin (bastante mala) del mximo de f
[fmaxest,indice]=max(phi); xmaxest=x(indice);
xmax=fzero('f4_4',0.5);
% Apartado a: Evaluacin de f
h=pi/16;
x=h:h:2*pi;
dosene=length(x);
n=dosene/2;
Pgina 6 de 14
Pgina 14 de 14