lsqnonlin function error confusion

1 visualización (últimos 30 días)
Robert Smith
Robert Smith el 20 de Sept. de 2017
Comentada: Robert Smith el 20 de Sept. de 2017
Hi, I was running this code and it was working well but when I made small modifications it stopped working. Any help or clarification is appreciated! See code and error below:
function [R] = optimize_radius (raw_EM_cath)
numcath = size(raw_EM_cath,2);
for i = 1:numcath
raw_EM_cath(i).cath = raw_EM_cath(i).cath(8:end,:);
center = lsqnonlin(@(point)distance(point, raw_EM_cath(i).cath), [median(raw_EM_cath(i).cath(:,1)), median(raw_EM_cath(i).cath(:,2)), median(raw_EM_cath(i).cath(:,3))]);
d = pdist2(center, raw_EM_cath(i).cath);
R(i, :) = [ mean(d), std(d), median(d), mode(d) ];
end
end
ERROR:
Output argument "d" (and maybe others) not assigned during call to
"optimize_radius>distance".
Error in optimize_radius>@(point)distance(point,raw_EM_cath(i).cath) (line 12)
center = lsqnonlin(@(point)distance(point, raw_EM_cath(i).cath),
[median(raw_EM_cath(i).cath(:,1)), median(raw_EM_cath(i).cath(:,2)),
median(raw_EM_cath(i).cath(:,3))]);
Error in lsqnonlin (line 196)
initVals.F = feval(funfcn{3},xCurrent,varargin{:});
Error in optimize_radius (line 12)
center = lsqnonlin(@(point)distance(point, raw_EM_cath(i).cath),
[median(raw_EM_cath(i).cath(:,1)), median(raw_EM_cath(i).cath(:,2)),
median(raw_EM_cath(i).cath(:,3))]);
Caused by:
Failure in initial objective function evaluation. LSQNONLIN cannot continue.
  4 comentarios
Walter Roberson
Walter Roberson el 20 de Sept. de 2017
There should not be a space between the dash and the "all". Not
which - all distance
But
which -all distance
Robert Smith
Robert Smith el 20 de Sept. de 2017
Oh, forgive me. Here is the output:
distance is a Java method % java.awt.Point method distance is a Java method % java.awt.geom.Point2D method

Iniciar sesión para comentar.

Respuestas (0)

Categorías

Más información sobre Just for fun 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