lsqnonlin stops early issue

3 visualizaciones (últimos 30 días)
bigseat
bigseat el 18 de Abr. de 2018
Editada: bigseat el 19 de Abr. de 2018
Hi, Everyone in our Matlab Community
I am trying to solve a time of arrival time problem with lsqnonlin function and find something interesting and I do not quite understand. Time of arrival problem is for a source at unknown location and time [x_s,y_s,z_s,t_s], its radiated wave travel to each station S1-S7 (i assumed 7 stations in my case) at the speed v, the locations of stations are known, the times of wave arrivals at each station are known as well ((x,y,z,ta) ). So I want to find out the time and location of the source from these knowns.
The equation used shown below:
t(i)=t_s+sqrt((x(i)-x_s)^2+(y(i)-y_s)^2+(z(i)-z_s)^2) % this is calculated time of arrival for station i, where x(i),y(i),z(i) are location of each station and are known, [t_s, x_s, y_s, z_s] are unknowns and what we want to get from lsqnonlin. ta(i) is the actual arrive time, which is known
To find out the best solution, we need to minimize the sum up of ((t(i)-ta(i))^2) for i from 1 to 7.
To do that, I first give faked a source at [5000 5000 8000] and let it radiate at time t=0 and travel at the speed of v. Locations of 7 stations are known, then I find out the arrival times for each station. After that, I try to go backward, try to use only the arrival times and location of stations to find out the source time and location by using lsqnonlin.
I found out when I set wave traveling speed v=3*1e3, the x output by lsqnonlin is correct and it takes 12 iterations, but when I set the wave traveling speed v=3*1e8, the output x are very far away from the true values of the faked source, but very close to the initial guess, actually it stops after the first iteration. Can someone tell me why and give suggestions to make it also work when I set v=3*1e8?

Respuestas (1)

Alan Weiss
Alan Weiss el 18 de Abr. de 2018

The problem seems to be poor scaling. The speed of light is awfully large, so the times are miniscule.

I suggest that you set your numbers so that the results are of order 1. In other words, instead of using v = 3e8, try scaling speed by a factor of 1e8 so that v = 3, and at the end scale your result by 1e8 to get answers in the units you prefer. See Center and Scale Your Problem or other suggestions in When the Solver Fails.

Alan Weiss

MATLAB mathematical toolbox documentation

  2 comentarios
bigseat
bigseat el 18 de Abr. de 2018
I changed the default values to 'TolX',1E-50,'TolFun',1E-50 and it works now...
Alan Weiss
Alan Weiss el 18 de Abr. de 2018
I'm glad that worked for you, but it is not the recommended procedure. See Tolerances and Stopping Criteria, where you will find that setting these tolrances to 1e-50 is the same as setting them to zero. This can lead to the solver not recognizing when it has converged.
Alan Weiss
MATLAB mathematical toolbox documentation

Iniciar sesión para comentar.

Categorías

Más información sobre Mathematics en Help Center y File Exchange.

Etiquetas

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by