%SCRIPT MATLAB INVERSI LINIER d=G(m)
%===================================%
%Kasus Acoustic Tomography Under-Determined
%Menentukan Matriks Kernel
%Forward Model Matriks Kernel
x=[1:1:16];
N=16; %jumlah data
M=8; %jumlah parameter model
G=zeros(N,M);
for i=[1:4];
for j=[1:4];
%measurment over rows
k=(i-1)*4+j;
G(i,k)=1;
%measurment over coloums
k=(j-1)*4+i;
G(i+4,k)=1;
end
end
s=rand(16,1); %Tebakan awal
h=1;
T=h*G*s; %Menentukan Nilai d atau T dari s tebakan (FORWARD)
a=G';
b=G*a;
c=a*pinv(b);
m=c*T; %Menentukan kembali s dari nilai T diatas (INVERSE)
%==================Plot Grafik=====================
clf;
figure(1)
subplot (3,2,1);
for p=1:4
for l=1:4
ss(p,l)=s(l+(p-1)*4);
end
end
imagesc(ss)
title('Model Awal sebelum Inversi')
subplot (3,2,2);
plot(s,'b-*')
title('Grafik sebelum Inversi')
subplot (3,2,3);
for p=1:4
for l=1:4
mm(p,l)=m(l+(p-1)*4);
end
end
imagesc(mm)
title('Model Akhir setelah Inversi')
subplot (3,2,4);
plot(m,'r-*')
title('Grafik setelah Inversi')
subplot (3,2,5)
plot(s,m,'ko','MarkerFaceColor','r')
title('Cross Plot')
subplot (3,2,6)
plot(x,s,'b-',x,m,'r-')
title('Cross Corelation')
%==========================ITERASI=====================