You are on page 1of 1

clc

clear all
syms x y ;
% p matrisindeki degerlerle oynanarak fonksiyonlardaki x ve y
% degiskenlerinin kuvvetleri degistirilerek farkli sonular elde edilir
n=2
p=[ 1 1 2 1 2 2];
T(1)=(((x-1).^(p(1)))).*(((y-1)).^(p(2))) ;
T(2)=(((x-1).^(p(3)))).*(((y-1)).^(p(4))) ;
T(3)=(((x-1).^(p(5)))).*(((y-1)).^(p(6)))
for i=1:n;
for j=1:n;
b0(i,j)=diff(T(i),x).*diff(T(j),x)+diff(T(i),y).*diff(T(j),y);
b1(i,j)=int(b0(i,j),x,0,1);
BL(i,j)=int(b1(i,j),y,0,1);
end
end
ByLineer=BL
for i=1:n;
L0(i)=T(i);
L1(i)=int(L0(i),x,0,1);
L(i)=int(L1(i),y,0,1);
end
L=L';
Lineer=L
C=((BL)^(-1))*L
if n==3 ;
Un=C(1)*T(1)+C(2)*T(2)+C(3)*T(3);
end
if n==2 ;
Un=C(1)*T(1)+C(2)*T(2);
end
if n==1 ;
Un=C(1)*T(1);
end
x=0:0.1:1;
f=subs(subs(Un,x),0);
fi=subs(subs(Un,(x+0.1)),0);
fg=subs(subs(Un,(x-0.1)),0);
df=(fi-fg)/(2*0.2);
plot(x,f,x,df)
grid on
legend('Un fonksiyonu','dUn/dx')
[x' f' df']