function My_Image_Al()
tic;
%UNTITLED3 Summary of this function goes here
% Detailed explanation goes here
%The room is 8x12x11,the coordinate of the receiver is (5,1,6)
%the coordinate of the sound source is (3,11,4) then
xro=8;xre=5;xso=3;
yro=12;yre=1;yso=10;
zro=10;zre=6;zso=4;
%define array d(i,j,k) which represents the distance from the
%virtual sound source to the receiver.
%define u(i,j,k,t) which is the delay time
i=1:21;
x=(-1).^(i-11)*xso+(i-11+(1-(-1).^(i-11))/2)*xro-xre;
y=(-1).^(i-11)*yso+(i-11+(1-(-1).^(i-11))/2)*yro-yre;
z=(-1).^(i-11)*zso+(i-11+(1-(-1).^(i-11))/2)*zro-zre;
q=340;
for i=1:21
for j=1:21
for k=1:21
for t=1:1000
d(i,j,k)=sqrt(x(i)^2+y(j)^2+z(k)^2);
u(i,j,k,t)=(t-1)/1000-d(i,j,k)/q;
end
end
end
end
%beta is the reflection factor
beta=0.5;
for i=1:21
for j=1:21
for k=1:21
b(i,j,k)=1/(4*pi*d(i,j,k)^2);
c(i,j,k)=beta^(abs(i-11)+abs(j-11)+abs(k-11));
e(i,j,k)=b(i,j,k)*c(i,j,k);
end
end
end
%define h(t) ,the unit pulse response
for t=1:1000
tmp=0;
for i=1:21
for j=1:21
for k=1:21
tes=Deta(u(i,j,k,t));
tmp=e(i,j,k)*tes+tmp;
end
end
end
h(t)=tmp;
end
t=1:1000;
figure(1);
stem(t,h);
xlabel('time/ms');
title('linear graph');
figure(2);
for i=1:1000
if h(i)~=0
break;
else
continue;
end
end
stem(t,20*log10(h/h(i)));
xlabel('time/ms');
title('DB graph');
toc;
end