Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add files via upload
  • Loading branch information
eja13003 committed Aug 6, 2018
1 parent f7d6026 commit 908ab64
Show file tree
Hide file tree
Showing 3 changed files with 488 additions and 0 deletions.
84 changes: 84 additions & 0 deletions AcousticSourceErrorMin.m
@@ -0,0 +1,84 @@

x1=0; y1=0; %m
x2=0; y2=0.20;
x3=0.10; y3=0;
X=[x1,x2,x3];
Y=[y1,y2,y3];
t12=2.7589e-5; %3.92322e-5; %s
t21=t12;
t13=-1.0425e-5; %3.37*40*10^-6;
t31=t13;
t23=-3.8014e-5; %-2.65811e-5;
t32=t23;
int=[0.1,0.1];
c=1110;
c1=1110;
c2=1110;
c3=1110;


E_xy=@(C) (t23*(sqrt((x1-C(1)).^2+(y1-C(2)).^2)-sqrt((x2-C(1)).^2+(y2-C(2)).^2))-...
t12*(sqrt((x2-C(1)).^2+(y2-C(2)).^2)-sqrt((x3-C(1)).^2+(y3-C(2)).^2))).^2+...
(t31*(sqrt((x2-C(1)).^2+(y2-C(2)).^2)-sqrt((x3-C(1)).^2+(y3-C(2)).^2))-...
t23*(sqrt((x3-C(1)).^2+(y3-C(2)).^2)-sqrt((x1-C(1)).^2+(y1-C(2)).^2))).^2+...
(t12*(sqrt((x3-C(1)).^2+(y3-C(2)).^2)-sqrt((x1-C(1)).^2+(y1-C(2)).^2))-...
t31*(sqrt((x1-C(1)).^2+(y1-C(2)).^2)-sqrt((x2-C(1)).^2+(y2-C(2)).^2))).^2;

E2_xy= @(C) (c*t12-(sqrt((x1-C(1)).^2+(y1-C(2)).^2)-sqrt((x2-C(1)).^2+(y2-C(2)).^2))).^2+...
(c*t13-(sqrt((x1-C(1)).^2+(y1-C(2)).^2)-sqrt((x3-C(1)).^2+(y3-C(2)).^2))).^2+...
(c*t23-(sqrt((x2-C(1)).^2+(y2-C(2)).^2)-sqrt((x3-C(1)).^2+(y3-C(2)).^2))).^2;

coord4=fminsearch(E2_xy,int);
coord4=fliplr(coord4);


%{
E_xy=@(C) (t23.*c3.*(c2.*sqrt((x1-C(1)).^2+(y1-C(2)).^2)-c1.*sqrt((x2-C(1)).^2+(y2-C(2)).^2))-...
t12.*c1.*(c3.*sqrt((x2-C(1)).^2+(y2-C(2)).^2)-c2.*sqrt((x3-C(1)).^2+(y3-C(2)).^2))).^2+...
(t31.*c1.*(c3.*sqrt((x2-C(1)).^2+(y2-C(2)).^2)-c2.*sqrt((x3-C(1)).^2+(y3-C(2)).^2))-...
t23.*c2.*(c1.*sqrt((x3-C(1)).^2+(y3-C(2)).^2)-c3.*sqrt((x1-C(1)).^2+(y1-C(2)).^2))).^2+...
(t12.*c2.*(c1.*sqrt((x3-C(1)).^2+(y3-C(2)).^2)-c3.*sqrt((x1-C(1)).^2+(y1-C(2)).^2))-...
t31.*c3.*(c2.*sqrt((x1-C(1)).^2+(y1-C(2)).^2)-c1.*sqrt((x2-C(1)).^2+(y2-C(2)).^2))).^2;
%}

coord2=fminsearch(E_xy,int);


[x,y]=meshgrid(0:0.002:max(X),0:0.002:max(Y));
%[x,y]=meshgrid(0.13:0.00005:0.132,0.022:0.00005:0.026);
%d1=sqrt((x1-x).^2+(y1-y).^2);
%d2=sqrt((x2-x).^2+(y2-y).^2);
%d3=sqrt((x3-x).^2+(y3-y).^2);
%z=(t23*(d1-d2)-t12*(d2-d1)).^2+(t31*(d2-d3)-t23*(d3-d1)).^2+(t12*(d3-d1)-t31*(d1-d2)).^2;
%surf(x,y,z)

%{
z2=(t23.*(sqrt((x1-x).^2+(y1-y).^2)-sqrt((x2-x).^2+(y2-y).^2))-...
t12.*(sqrt((x2-x).^2+(y2-y).^2)-sqrt((x3-x).^2+(y3-y).^2))).^2+...
(t31.*(sqrt((x2-x).^2+(y2-y).^2)-sqrt((x3-x).^2+(y3-y).^2))-...
t23.*(sqrt((x3-x).^2+(y3-y).^2)-sqrt((x1-x).^2+(y1-y).^2))).^2+...
(t12.*(sqrt((x3-x).^2+(y3-y).^2)-sqrt((x1-x).^2+(y1-y).^2))-...
t31.*(sqrt((x1-x).^2+(y1-y).^2)-sqrt((x2-x).^2+(y2-y).^2))).^2;
%}

%An improved algorithm for detecting point of impact in anisotropic inhomogeneous plates
z3=(c*t12-(sqrt((x1-x).^2+(y1-y).^2)-sqrt((x2-x).^2+(y2-y).^2))).^2+...
(c*t13-(sqrt((x1-x).^2+(y1-y).^2)-sqrt((x3-x).^2+(y3-y).^2))).^2+...
(c*t23-(sqrt((x2-x).^2+(y2-y).^2)-sqrt((x3-x).^2+(y3-y).^2))).^2;


surf(x,y,log(z3))
xlabel('x-axis (meters)')
ylabel('y-axis (meters)')
zlabel('log (Error Function)')

Min=min(z3(:));
[row,col]=find(z3==Min);
s=size(z3);
Ind=find(z3==Min);
[i,j]=ind2sub(s,Ind);


coord3=[x(row,col),y(row,col)]


0 comments on commit 908ab64

Please sign in to comment.