|
"Miroslav Balda" <balda.nospam@cdm.it.cas.cz> wrote in
message <g8dp5i$509$1@fred.mathworks.com>...
> "Mazahir " <maz_p5@hotmail.com> wrote in message
> <g8bugl$e7c$1@fred.mathworks.com>...
> > Hello,
> >
> > I am finding out the location of a sound source using
> > microphones. The co-ordinates of the 3 mics are fixed.
> > Suppose the co-ordinates of the 3 mics are (x1,y1),(x2,y2)
> > and (x3,y3) and the distance of source of sound from the 1st
> > mic to the 2nnd is - del12 and the source of sound from the
> > 1st mic to the 3rd is del13. how do i find the location of
> > the source (x,y) in MATLAB using the following formula.
> >
> > del12=sqrt((x1-x)^2+(y1-y)^2)- sqrt((x2-x)^2+(y2-y)^2)
> > del13=sqrt((x1-x)^2+(y1-y)^2)- sqrt((x3-x)^2+(y3-y)^2)
> >
> > Solving this equation of 2 unknowns simultaneously will give
> > me the point (x,y). But i do not know how to do it in
> > matlab. I think there is a solution using matrices. Please
> > help. thank you.
>
> Hi,
>
> Mazahir, your problem is more complicated, because there is
> one equation more:
> del23=sqrt((x2-x)^2+(y2-y)^2)- sqrt((x3-x)^2+(y3-y)^2)
> Since your measured dels suffer from measurement error, the
> three equations are overdetermined for two unknowns [x,y].
> It is a problem which can be solved by a least squares
> method. there is the code for simulated problem:
>
> x = [14,95,72];
> y = [30,18,73];
> xy = [x;y];
> dxy = [59,27,39]; % approximate distances from corners
> d = [dxy(1)-dxy(2),dxy(2)-dxy(3),dxy(3)-dxy(1)]; % deltas
> del = @(a,b) sqrt((a-b)'*(a-b));
> res = @(z) [del(xy(:,1),z)-del(xy(:,2),z) - d(1)
> del(xy(:,2),z)-del(xy(:,3),z) - d(2)
> del(xy(:,3),z)-del(xy(:,1),z) - d(3)
> ];
> [XY,ssq,cnt] = LMFnlsq(res,sum(xy')'/3,'Display',1)
>
> with the solution:
>
> XY =
> 73.0034
> 33.8819
> ssq =
> 4.6659e-024
> cnt =
> 4
>
> The solution is very good, because sum of squares from the
> staring point, chosen in the centre of gravity ofthe
> triangle, has been ssq=1e3 (!). The function LMFnlsq is from
> File Exchange under Id 17534.
>
> Hope it helps.
>
> Mira
Hi Mira,
Sorry but I could not understand your solution well. I know
that solving by least square method might be the best option
but can you please describe the solution and the variables
used like d,a,b,z, res, etc.. dxy is the approx. distance
from corners, but distance of what? Also are the values
randomly taken by you?
Also below I am explaining you the problem again in detail,
so that you can get a clear picture.
I have to find the location of a sound source on a 2d plane.
(I am not considering z axis). I have 4 mics the
co-ordinates of which are m1(0,0), m2(0,6), m3(4,6), m4(4,0).
del12 is the difference between the distance from mic 1 to
the source and from mic 2 to the source.
del12=((time taken to reach 1st mic-time taken to reach 2nd
mic) x v sound i.e. 340m/s)/fs i.e. 44000. Therefore, for a
particular set of readings, the calculated del12 = 0.0848.
Similarly, del13 = 0.9098 and del14 = 0.5937
Now solving the equations below simultaneously using least
square method will give me the point.
del12=sqrt((x1-x)^2+(y1-y)^2)- sqrt((x2-x)^2+(y2-y)^2)
del13=sqrt((x1-x)^2+(y1-y)^2)- sqrt((x3-x)^2+(y3-y)^2)
del14=sqrt((x1-x)^2+(y1-y)^2)- sqrt((x4-x)^2+(y4-y)^2)
Now this is the exact problem which I cant get hang of.
I think 1st solving with just 3 mics and 2 equations will be
good enough to predict the output before going to the 4th mic.
Also what I know is that such systems can also be solved by
techniques such as multilateration. If yes, would that be
easier?
Please do reply soon.
Thank you,
Mazahir
|