Está en la página 1de 15

MÉTODO DE RESOLUCIÓN DE ECUACIONES NO LINEALES

MÉTODO DE BISECCIÓN
clc;
clear all;
disp('Metodo de Biseccion');
a=input('Ingrese el valor de a=');
b=input('Ingrese el valor de b=');
fa= Mifuncion(a);
fb= Mifuncion(b);
if (fa*fb>0)
disp('Los valores de a y b no encierran solucion');
end
tol=input('Ingrese el error de aproximacion=');
nmax=input('Ingrese el numero maximo de iteraciones=');
Mierror= tol+1;
n=0;
while (Mierror>tol)&&(n<nmax)
n=n+1;
m=(a+b)/2;
fm= Mifuncion(m);
Mierror=abs(fm);
if fa*fm<0
b=m;
fb=fm;
else
a=m;
fa=fm;
end
if n>=nmax
disp('Se alcanzo el numero maximo de iteraciones');
nmax=input('Ingrese el numero maximo de iteraciones=');
end
end
tmp=sprintf('La respuesta es %f y se obtuvo en %d iteraciones',m,n);
disp(tmp);

MÉTODO DE NEWTON RAPHSON


clc
clear all
disp('Metodo de Newton Raphson');
x0=input('Ingrese el valor inicial de X=');
etol=input('Ingrese error de aproximacion=');
nmax=input('Ingrese numero maximo de iteraciones=');
err=etol+1;
n=0;
while (n<nmax)&&(err>etol)
n=n+1;
m=mifuncion(x0)/mifuncionderivada(x0);
x1=x0-m;
err=abs(x1-x0);
x0=x1;
end
if n>nmax
error('La solucion no converge');
else
tmp=sprintf('La respuesta es %f y se obtuvo en %d
iteraciones',x1,n);
disp(tmp);
end

MÉTODO DE LA SECANTE
clc
clear all
X0=input('Ingrese el valor de x0=');
X1=input('Ingrese el valor de x1=');
etol=input('Ingrese el error de tolerancia=');
nmax=input('Ingrese numero maximo de iteraciones=');
n=0;
err=etol+1;
while (err>etol)&&(n<nmax)
Fx0=mifuncion(X0);
Fx1=mifuncion(X1);
X2=X1-((Fx1*(X0-X1))/(Fx0-Fx1));
err=abs(X2-X1);
X0=X1;
X1=X2;
n=n+1;
end
if n>nmax
error('La solucion no converge');
else
tmp=sprintf('La respuesta es %f y se obtuvo en %d iteraciones',x1,n);
disp(tmp);
end

MÉTODO DE PUNTO FIJO


clc
clear all
disp('Metodo de Punto Fijo');
x0=input('Ingrese el valor inicial de x=');
etol=input('Ingrese el error de aproximacion=');
nmax=input('Ingrese el numero maximo de iteraciones=');
x1=0;
err=etol+1;
n=0;
while err>etol && nmax>n
x1=derivadag(x0);
m=x1-x0;
err=abs(m);
n=n+1;
x0=x1;
end
tmp=sprintf('La respuesta es %f y se obtuvo en %d iteraciones',x1,n);
disp(tmp)

MÉTODO DE REGULA FALSI


clc
clear all
disp('Metodo de Regula Falsi');
fa=1;
fb=1;
while fa*fb>0
a=input('Ingrese el valor de a=');
b=input('Ingrese el valor de b=');
fa=funcion(a);
fb=funcion(b);
if (fa*fb>0)
disp('Los valores de a y b no encierran solucion');
end
end
etol=input('Ingrese el error de aproximacion=');
nmax=input('Ingrese el numero maximo de iteraciones=');
err=etol+1;
n=0;
while err>etol && nmax>n
l=fb-fa;
g=b-a;
m=a-((fa/l)*g);
fm=funcion(m);
err=abs(fm);
if fa*fm>0
a=m;
fa=fm;
else
b=m;
fb=fm;
end
n=n+1;
end
tmp=sprintf('La respuesta es %f y se obtuvo en %d iteraciones',m,n);
disp(tmp)

MÉTODO DE REGULA FALSI MODIFICADO


clc
clear all
disp('Metodo de Regula Falsi Modificado');
fa=1;
fb=1;
while fa*fb>0
a=input('Ingrese el valor de a=');
b=input('Ingrese el valor de b=');
fa=funcion(a);
fb=funcion(b);
if (fa*fb>0)
disp('Los valores de a y b no encierran solucion');
end
end
etol=input('Ingrese el error de aproximacion=');
nmax=input('Ingrese el numero maximo de iteraciones=');
err=etol+1;
n=0;
while err>etol && nmax>n
l=fb-fa;
g=b-a;
m=a-((fa/l)*g);
fm=funcion(m);
err=abs(fm);
if fa*fm>0
a=m;
fa=fm;
fb=fb/2;
else
b=m;
fa=fa/2;
fb=fm;
end
n=n+1;
end
tmp=sprintf('La respuesta es %f y se obtuvo en %d iteraciones',m,n);
disp(tmp)

POLINOMIOS
MÉTODO DE RUFFINI
%Método de Rufini para evaluar polinomios
clc
clear all
disp('El polinomio debe ser de la forma P(x)= a(n)X^n + a(n-1)X^(n-1)
+ ... a(1)X + a(0)');
n=input('Ingrese el grado del polinomio a evaluar =');
%pedir los coeficientes del polinomio
for i=n+1:-1:1
Mensaje =sprintf('Ingrese el coeficiente a(%d)=', i-1);
x(i)=input(Mensaje);
end

Rta='S';
while(Rta=='S' || Rta=='s')
m=input('Ingrese el punto a evaluar =');
b=x(n+1);
b1=b;
for i=n:-1:1
b=b*m+x(i);
A(i)=b;
end
A=[A b1];
Mensaje =sprintf('El polinomio evaluado en %f es %f', m,b);
disp(Mensaje);
Rta=input('Desea evaluar otro punto S=SI, N=NO ','s');
End

METODO DE NEWTON RUFFINI


clc;
clear all;
disp('El polinomio debe ser de la forma P(x)= a(n)X^n + a(n-1)X^(n-1)
+ ... a(1)X + a(0)');
n=input('Ingrese el grado del polinomio a evaluar ');
for i=n+1:-1:1
Mensaje =sprintf('Ingrese el coeficiente a(%d)= ', i-1);
x(i)=input(Mensaje);
end
x0=input('Ingrese un valor cercano a la solución = ');
tol=input('Ingrese el error de aproximación = ');
nmax=input('Ingrese el número máximo de iteraciones = ');
niter = 0;
Mierror = 1 + tol;
while Mierror>tol && niter <=nmax
[fx, dfx]=FuncionRuffini(x,n,x0);
x1 = x0 - fx/dfx;
Mierror = abs(x1-x0);
x0=x1;
niter = niter +1;
end
if niter>=nmax
disp('El método se ha detenido por superar el número de iteraciones');
else
tmp=sprintf('La respuesta es %f y se llegó en %d iteraciones',x0,niter);
disp(tmp);
end

function [ valor, derivada ] = FuncionRuffini( A,n,x )


B(n+1)=A(n+1);
for i=n:-1:1
B(i)=B(i+1)*x + A(i);
end
valor=B(1);
C(n+1)=B(n+1);
for i=n:-1:2
C(i)=C(i+1)*x + B(i);
end
derivada=C(2);
end

MÉTODO DE FACTORES CUADRÁTICOS-BAIRSTOW


clc
clear all
disp('El polinomio debe ser de la forma P(x)= a(0)X^n + a(1)X^(n-1) +
... a(n-1)X + a(n)');
n=input('Ingrese el grado del polinomio = ');
for i=1:n+1
msj=sprintf('ingrese el coeficiente de %d° grado = ',i-1);
A(i)=input(msj);
end
p=input('ingrese valor inicial de p = ');
q=input('ingrese valor inicial de q = ');
error=input('Ingrese el valor del error = ');
B(1)=A(1);
cont=0;
Mierror=error + 1;
while ( Mierror>error && (cont<1000) )
B(2)=A(2)-p*B(1);
for i=3:n-1
B(i)=A(i)-p*B(i-1)-+q*B(i-2);
end
dP=(A(n)-p*B(n-1)-q*B(n-2))/B(n-1);
dQ=(A(n+1)-q*B(n-1))/B(n-1);
p=p+dP;
q=q+dQ;
cont=cont+1;
if(abs(dP)>abs(dQ))
Mierror=abs(dP);
else
Mierror=abs(dQ);
end
end
if(cont>=1000)
error('El sistema no converge a las 1000 iteraciones');
end
tmp=sprintf('El valor de P=%f y de Q=%f',p,q);
disp(tmp);
if(p*p-4*q>0)
x1= (-p+(p*p-4*q)^0.5)/2;
x2= (-p+(p*p-4*q)^0.5)/2;
tmp=sprintf('La solución es %f y %f',x1,x2);
disp(tmp);
else
p_real=-p/2;
p_img =((-p*p+4*q)^0.5)/2;
tmp=sprintf('La solución es (%f %+fj) y (%f
%+fj)',p_real,p_img,p_real,-p_img);
disp(tmp);
end

INTERPOLACIÓN
MÉTODO DE LAGRANGE
clc
clear all
n=input('Ingresar el número de puntos=');
for i=1:n
tmp=sprintf('Ingrese el x(%d)=',i);
x(i)=input(tmp);
tmp=sprintf('Ingrese el y(%d)=',i);
y(i)=input(tmp);
end
a=input('Ingresar el punto a interpolar=');
for i=1:n
L(i)=1;
for j=1:n
if i~=j
L(i)=L(i)*(a-x(j))/(x(i)-x(j));
end
end
end
s=0;
for i=1:n
s=s+L(i)*y(i);
end
temp=sprintf('El valor interpolado es %f',s);
disp(temp)

MÉTODO DE DIFERENCIAS DIVIDIDAS


clc
clear all
n=input('Ingrese número de puntos=');
A=zeros(n,n+1);
for i=1:n
msj1=sprintf('Ingrese X(%d)=',i);
A(i,1)=input(msj1);
msj1=sprintf('Ingrese Y(%d)=',i);
A(i,2)=input(msj1);
end
a=input('Ingrese punto a interpolar=');
for i=1:n-1
for j=1:n-i
A(j,2+i)=(A(j+1,1+i)-A(j,1+i))/(A(j+i,1)-A(j,1));
end
end
valor=A(1,2);
for i=2:n
L=1;
for j=1:i-1
L=L*(a-A(j,1));
end
valor=valor+A(1,i+1)*L;
end
msj1=sprintf('El valor interpolado es %f',valor);
disp(msj1)

AJUSTES
AJUSTE POLINOMIAL-Minimos Cuadrados
clc
clear all
n = input('Ingrese el número de puntos = ');
T=zeros(3);
U=zeros(3,1);
for i=1:n
msj=sprintf('ingrese el punto X(%d) = ',i);
X(i)=input(msj);
msj=sprintf('ingrese el punto Y(%d) = ',i);
Y(i)=input(msj);
T(1,2)=T(1,2)+X(i);
T(1,3)=T(1,3)+X(i)^2;
T(2,3)=T(2,3)+X(i)^3;
T(3,3)=T(3,3)+X(i)^4;
U(1,1)=U(1,1)+Y(i);
U(2,1)=U(2,1)+Y(i)*X(i);
U(3,1)=U(3,1)+Y(i)*X(i)^2;
end
T(1,1)=n;
T(2,1)=T(1,2);
T(2,2)=T(1,3);
T(3,1)=T(2,2);
T(3,2)=T(2,3);
A=inv(T)*U;
msj=sprintf('La ecuación cuadrática es y=%f%+fx%+fx^2',A(1),A(2),A(3));
disp(msj)

AJUSTE LINEAL
clc
clear all
n = input('Ingrese el número de puntos = ');
T=zeros(2);
U=zeros(2,1);
for i=1:n
msj=sprintf('ingrese el punto X(%d) = ',i);
X(i)=input(msj);
msj=sprintf('ingrese el punto Y(%d) = ',i);
Y(i)=input(msj);
T(1,2)=T(1,2)+X(i);
T(2,2)=T(2,2)+X(i)^2;
U(1,1)=U(1,1)+Y(i);
U(2,1)=U(2,1)+Y(i)*X(i);
end
T(1,1)=n;
T(2,1)=T(1,2);
A=inv(T)*U;
msj=sprintf('La ecuación lineal es y=%f%+fx',A(1),A(2));
disp(msj)

AJUSTE EXPONENCIAL
clc
clear all
n = input('Ingrese el número de puntos = ');
T=zeros(2);
U=zeros(2,1);
for i=1:n
msj=sprintf('Ingrese el punto X(%d) = ',i);
X(i)=input(msj);
msj=sprintf('Ingrese el punto Y(%d) = ',i);
Y(i)=input(msj);
T(1,2)=T(1,2)+X(i);
T(2,2)=T(2,2)+X(i)^2;
U(1,1)=U(1,1)+log(Y(i));
U(2,1)=U(2,1)+log(Y(i))*X(i);
end
T(1,1)=n;
T(2,1)=T(1,2);
A=inv(T)*U;
A(1)=exp(A(1));
msj=sprintf('La ecuación exponencial es y=%fe^(%fx)',A(1),A(2));
disp(msj)

AJUSTE POTENCIAL
Clc;
clear all;
n = input('Ingrese el número de puntos = ');
T=zeros(2);
U=zeros(2,1);
for i=1:n
msj=sprintf('Ingrese el punto X(%d) = ',i);
X(i)=input(msj);
msj=sprintf('Ingrese el punto Y(%d) = ',i);
Y(i)=input(msj);
T(1,2)=T(1,2)+log(X(i));
T(2,2)=T(2,2)+log(X(i))^2;
U(1,1)=U(1,1)+log(Y(i));
U(2,1)=U(2,1)+log(Y(i))*log(X(i));
end
T(1,1)=n;
T(2,1)=T(1,2);
A=inv(T)*U;
A(1)=exp(A(1));
msj=sprintf('La ecuación potencial es y=%fx^(%f)',A(1),A(2));
disp(msj)

AJUSTES A FUNCIONES CONOCIDAS

EJEMPLO: y=Ao+A1*sen(x)+A2*cos(x) [Con gráfica]


clc
clear all
n = input('Ingrese el número de puntos = ');
T=zeros(3);
U=zeros(3,1);
for i=1:n
msj=sprintf('ingrese el punto X(%d) = ',i);
X(i)=input(msj);
msj=sprintf('ingrese el punto Y(%d) = ',i);
Y(i)=input(msj);
T(1,2)=T(1,2)+sin(X(i));
T(1,3)=T(1,3)+cos(X(i));
T(2,2)=T(2,2)+sin(X(i))^2;
T(2,3)=T(2,3)+sin(X(i))*cos(X(i))
T(3,3)=T(3,3)+cos(X(i))^2;
U(1,1)=U(1,1)+Y(i);
U(2,1)=U(2,1)+Y(i)*sin(X(i));
U(3,1)=U(3,1)+Y(i)*cos(X(i));
end
T(1,1)=n;
T(2,1)=T(1,2);
T(3,1)=T(2,2);
T(3,2)=T(2,3);
A=inv(T)*U;
msj=sprintf('La ecuación cuadrática es y=%f%+fsen(x)%+fcos(x)',A(1),A(2),A(3));
disp(msj);
R=1;
for i=X(1):0.01:X(n)
p(R)=i;
q(R)=A(1)+A(2)*sin(i)+A(3)*cos(i);
R=R+1;
end
figure(1)
plot(X,Y,'*',p,q,'-r','LineWidth',1);
grid

CALCULO DE INTEGRALES

Método Simpson 1/3


clc;
clear all;
disp('Simpson 1/3');
a= input('Ingrese el límite inferior a= ');
b= input('Ingrese el límite superior b= ');
fa= Mifuncion(a);
fb= Mifuncion(b);
if b<a
c=b;
b=a;
a=c;
end
n= input('Ingrese el número de divisiones N= ');
h=(b-a)/n;
suma= fa+ fb;
for i=1:1:(n-2)/2
fc= Mifuncion(a+h*(2*i));
suma= suma+2*fc;
end
for i=0:1:(n-2)/2
fd= Mifuncion(a+h*(2*i+1));
suma= suma+4*fd;
end
suma= suma*h/3;
Rpta= sprintf('La respuesta de la integral es %f',suma);
disp(Rpta);

Método de Simpson 3/8

clc;
clear all;
disp('Simpson 3/8');
a= input('Ingrese el límite inferior a= ');
b= input('Ingrese el límite superior b= ');
fa= Mifuncion(a);
fb= Mifuncion(b);
if b<a
c=b;
b=a;
a=c;
end
n= input('Ingrese el número de divisiones N= ');
h=(b-a)/n;
suma= fa+fb;
for i=1:1:(n-3)/3
fc= Mifuncion(a+h*(3*i));
suma= suma+2*(fc);
end
for i=0:1:(n-3)/3
fd= Mifuncion(a+h*(3*i+1));
suma= suma+3*fd;
end
for i=0:1:(n-3)/3
fe= Mifuncion(a+h*(3*i+2));
suma= suma+3*fe;
end
suma= suma*h*3/8;
Rpta= sprintf('La respuesta de la integral es %f',suma);
disp(Rpta);

ECUACIONES DIFERENCIALES ORDINARIAS

Método de Euler

clc;
clear all;
x(1)= input('Ingrese el valor de x inicial= ');
y(1)= input('Ingrese el valor de y inicial= ');
h= input('Ingrese el valor del paso= ');
xf= input('Ingrese el valor de x final= ');
j=2;
for i= x(1)+h:h:xf
x(j)=x(j-1)+h;
y(j)=y(j-1)+h*mi_funcion7(x(j-1),y(j-1));
j= j+1;
end
plot(x,y);
disp(x(j-1));
disp(y(j-1));

Método de Euler modificado

clc;
clear all;
x(1)= input('Ingrese el valor de x inicial= ');
y(1)= input('Ingrese el valor de y inicial= ');
h= input('Ingrese el valor del paso= ');
xf= input('Ingrese el valor de x final= ');
j=2;
for i= x(1)+h:h:xf
x(j)=x(j-1)+h;
y(j)=y(j-1)+h*mi_funcion7(x(j-1),y(j-1));
y(j)=y(j-1)+h*(mi_funcion7(x(j-1),y(j-
1))+mi_funcion7(x(j),y(j)))/2;
j= j+1;
end
plot(x,y);
disp(x(j-1));
disp(y(j-1));

Método de Runge Kutta 4to Orden

clc;
clear all;
disp('Código de Runge Kutta');
x(1)= input('Ingrese el valor de X0= ');
y(1)= input('Ingrese el valor de y0= ');
h= input('Ingrese el peso h= ');
xf= input('Ingrese el punto final xf= ');
i=1;
for j= x(1)+h:h:xf
x(i+1)= x(i)+h;
k1= h*MifuncionF(x(i),y(i));
k2= h*MifuncionF(x(i)+(h/2),y(i)+(k1/2));
k3= h*MifuncionF(x(i)+(h/2),y(i)+(k2/2));
k4= h*MifuncionF(x(i)+h,y(i)+k3);

y(i+1)= y(i)+(k1+2*k2+2*k3+k4)/6;
i= i+1;
end
R = [y'];
disp('los valores de X e Y son:');
disp(R)

function valor=MifuncionF(x,y)
valor=2*x*y + x;
end
SISTEMA DE ECUACIONES DIFERENCIALES

clc;
clear all;
t(1) = input('ingrese el valor t inicial = ');
x(1) = input('ingrese el valor X inicial = ');
y(1) = input('ingrese el valor de Y inicial = ');
tn = input('ingrese el valor de t final = ');
h = input('ingrese el valor de h = ');
i=1;
for j = t(1)+h:h:tn
t(i+1) = t(i)+h;
k1x=h*MifuncionX(t(i),x(i),y(i));
k1y=h*MifuncionY(t(i),x(i),y(i));
k2x=h*MifuncionX(t(i)+h/2,x(i)+k1x/2,y(i)+k1y/2);
k2y=h*MifuncionY(t(i)+h/2,x(i)+k1x/2,y(i)+k1y/2);
k3x=h*MifuncionX(t(i)+h/2,x(i)+k2x/2,y(i)+k2y/2);
k3y=h*MifuncionY(t(i)+h/2,x(i)+k2x/2,y(i)+k2y/2);
k4x=h*MifuncionX(t(i)+h,x(i)+k3x,y(i)+k3y);
k4y=h*MifuncionY(t(i)+h,x(i)+k3x,y(i)+k3y);

x(i+1) = x(i)+(k1x+2*k2x+2*k3x+k4x)/6;
y(i+1) = y(i)+(k1y+2*k2y+2*k3y+k4y)/6;
i = i+1;
end
R = [x', y'];
disp('los valores de X e Y son:')
disp(R)

CODIGO DE MATRICES

Método de multiplicación de matrices

clc;
clear all;
n=input('ingrese número de filas para A');
p=input('ingrese número de columnas para A');
q=input('ingrese número de filas para B');
r=input('ingrese número de columnas para B');
if(p~=q)
error('Las matrices no se pueden multiplicar')
end
for i=1:n
for j=1:p
temp=sprintf('ingrese valor para posicion A(%d,%d):',i,j);
A(i,j)=input(temp);
end
end
for i=1:q
for j=1:r
temp=sprintf('ingrese valor para posicion B(%d,%d):',i,j);
B(i,j)=input(temp);
end
end
for i=1:n
for j=1:r
C(i,j)=0;
for k=1:p
C(i,j)=C(i,j)+A(i,k)*B(k,j);
end
end
end
%respuesta

Método de determinante sin pivoteo

clc;
clear all;
disp('Determinante de una matriz sin pivoteo');
n= input('Ingrese el orden de la matriz= ');
for i= 1:n
for j=1:n
tmp= sprintf('A(%d,%d)= ',i,j);
A(i,j)= input(tmp);
end
end
s=1;
for i= 1:n-1
for j= i+1:n
m= (A(j,i)/A(i,i));
for k= 1:n
A(j,k)= A(j,k)-m*A(i,k);
end
end
end
for i= 1:n
s= s*A(i,i);
end
tmp= sprintf('El determinante es %f',s);
disp(tmp);

Método de determinante con pivoteo

clc;
clear all;
disp('Determinante de una matriz con pivoteo');
n=input('ingrese el orden de la matriz= ');
for i=1:n
P(i)=i;
for j=1:n
tmp=sprintf('A(%d,%d)=',i,j);
A(i,j)=input(tmp);
end
end
s=1;
for i=1:n-1
if (A(P(i),i)==0)
r=1;
for k=i+1:n
if (A(P(k),i)~=0)
a=P(i);
P(i)=P(k);
P(k)=a;
r=0;
s=s*-1;
break;
end
end
if (r==1)
error('la matriz no es linealmente independiente')
end
end
for j=i+1:n
M=(A(P(j),i))/(A(P(i),i));
for k=i:n
A(P(j),k)=A(P(j),k)-M*A(P(i),k);
end
end
end
for i=1:n
s=s*(A(P(i),i));
end
tmp=sprintf('El determinante es %f',s);
disp(tmp);

Sistema NxN – Gauss sin pivoteo

clc;
clear all;
disp('Sistema NxN sin pivoteo');
n= input('Ingrese el número de ecuaciones= ');
for i= 1:n
for j= 1:n+1
msj= sprintf('Ingrese el elemento A(%d,%d)= ',i,j);
A(i,j)= input(msj);
end
end
for i= 1:n-1
for j= i+1:n
M= -(A(j,i)/A(i,i));
for k= i:n+1
A(j,k)= A(j,k)+M*A(i,k);
end
end
end
for k= n:-1:1
tmp=0;
for j= k+1:n
tmp= tmp+A(k,j);
end
X(k)= (A(k,n+1)-tmp)/A(k,k);
end
tmp= sprintf('La respuesta es %d',X(k));
disp(tmp);

Sistema NxN – Gauss con pivoteo


clc;
clear all;
disp('Sistema NxN con pivoteo');
n= input('Ingrese el numero de ecuaciones= ');
for i= 1:n
P(i)=i;
for j= 1:n+1
msj= sprintf('Ingrese el elemento A(%d,%d)= ',i,j);
A(i,j)= input(msj);
end
end
for i= 1:n-1
if (A(P(i),i)==0)
r=1;
for k= i+1:n
if (A(P(K),i)~=0)
T= P(k);
P(k)=P(i);
P(i)= T;
r= 0;
break;
end
end
if (r==1)
error('El sistema no es independiente');
end
end
for j= i+1:n
M= -(A(P(j),i)/A(P(i),i));
for k= i:n+1
A(P(j),k)=A(P(j),k)+M*A(P(i),k);
end
end
end
for k= 1:n
if (A(P(k),k)==0)
error('El sistema no es linealmente independiente');
end
end
for k= n:-1:1
tmp= 0;
for j= k+1:n
tmp= tmp+X(j)*A(P(k),j);
end
X(k)= (A(P(k),n+1)-tmp)/A(P(k),k);
end
disp(X);

También podría gustarte