Technical discussion about Matlab and issues related to Digital Signal Processing.
I am trying to solve a system of equations, there are
three unknowns (x,y,z) outputed at the end of the code
as solX, SolY and solD.. for some reason, I keep getting
incorrect answers..
I am getting:
solX = 1.113114389722870e+002
SolY = 62.620043782546148
solD = -1.243181061282195e+002
where X should be ~ 0.2 and y~0.25
so I am not sure whats going wrong..
------------------------------------------------------
format long
%%%coordinates of receivers
X=[50.02 100.02 0.03 50.01 100.01];
Y=[0.05 0.06 50.04 50.05 50.06];
nRx=5; % no. of receivers
Xref = 0.02; % reference antenna coordinates (hence total=6)
Yref = 0.04;
TDOA=[0.0235424 0.17281532 0.0001875259 0.023730196 0.1729027]; %time difference of arrival..
Light=[300];
G=TDOA.*Light; %%% gives distance
for n=(1:nRx);
r(n) = realsqrt( ((X(n)-Xref)^2)+( (Y(n)-Yref)^2) ); % r(n)= receiver - ref.receiver
rdx(n,:)= [X(n)-Xref]';
rdy(n,:)= [Y(n)-Yref]';
g2=TDOA.^2;
r2=r(n).^2;
end
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%% THE PROBLEM %%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MatrixA=[2*rdx , 2*rdy , 2*G'];
MatrixC=[r2 - g2]';
temp=MatrixA\MatrixC;
solX=temp(1)
SolY=temp(2)
solD=temp(3)