You are on page 1of 1

%solucion por diferencias finitas

function [P] = vectorsoldiffi(r,p,q,t,b,n,a)


n=input('ingrese los valores de n:');
a=input('ingrese los valores de a o alfa:');
b=input('ingrese los valores de b o beta:');
c=input('ingrese los valores de c:');
d=input('ingrese los valores de d o gama:');
t=input('ingrese los valores de t:');

h=1/(n+1);
r=d-0.5*(c*h);
p=-2*d;
q=d+0.5*(c*h);
for i=1:n
A(i,i)= p+(2*r)*sqrt(q/r)*cos(i*pi/(n+1));
x(i,1)=i*h;
I=eye(n);
D2=exp(b*t)*I;
B1=I(1,1:n);
B2=I(end,:);
for j=1:n
P(i,j)=(q/r)^(i/2)*sin((i*j*pi)/(n+1));
end
D(i,i)=exp(t*A(i,i));
E3=(b*t)*I;

end
y=exp(a*x);
P1=inv(P);
E2=P1*y;
V1=D*E2;
D3=D2-D;
E4=E3-A;
V2=inv(E4);
V3=V2*D3;
W1=P1*(q*B1'+(exp(a)*r)*B2');
V=((n+1)^2)*(V3*W1);
V5=V1+V;
V6=P*V5;
end

You might also like