Cannot find solution when using fsolve
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi all,
I am trying to solve the following nonlinear equations using fsolve:
basex=-60.0235;
basey=-7.0012;
options=optimset('Algorithm','levenberg-marquardt');
X=fsolve(@(x)[basex/sqrt(4*x(2)^2*x(1)^2+1)...
-basey*2*x(2)*x(1)/sqrt(4*x(2)^2*x(1)^2+1)+x(1);...
basex*2*x(2)*x(1)/sqrt(4*x(2)^2*x(1)^2+1)...
+basey/sqrt(4*x(2)^2*x(1)^2+1)+x(1)^2*x(2)],[59;-0.001],options)
However, I was told no solution found. Acctually there should be a solution, because the basex and basey value is generated through the same set of equations:
x=[60;-0.002];
A=[1/sqrt(4*x(2)^2*x(1)^2+1) -2*x(2)*x(1)/sqrt(4*x(2)^2*x(1)^2+1) x(1);
2*x(2)*x(1)/sqrt(4*x(2)^2*x(1)^2+1) 1/sqrt(4*x(2)^2*x(1)^2+1) x(1)^2*x(2);
0 0 1];
B=[0;0;1];
Base=linsolve(A,B) % basex=Base(1),basey=Base(2)
Anyone can help me with this? Thanks a lot!
-Bay
0 comentarios
Respuestas (1)
Star Strider
el 23 de Mzo. de 2016
You need to do element-wise operations using the dot (.) operator:
basex=-60.0235;
basey=-7.0012;
options=optimset('Algorithm','levenberg-marquardt');
X=fsolve(@(x)[basex./sqrt(4*x(2).^2.*x(1).^2+1)...
-basey*2.*x(2).*x(1)./sqrt(4*x(2).^2.*x(1).^2+1)+x(1);...
basex*2*x(2).*x(1)./sqrt(4*x(2).^2.*x(1).^2+1)...
+basey./sqrt(4*x(2).^2.*x(1).^2+1)+x(1).^2.*x(2)],[59;-0.001],options)
X =
35.1460e-006
-4.9918e-003
0 comentarios
Ver también
Categorías
Más información sobre Image Processing Toolbox en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!