- Failure if any of the variables other than x in your f_gamma_r_delta_v are not scalars
- exception: if Q is a row vector and phi0+beta is a column vector of the same length, their algebraic product would be a scalar, which would work
- Special emphasis: you are going to have a failure if any of those variables are empty. This is a common failure mode when the variables turn out to be globals
- Failure if any of those variables are nan or inf
- Special emphasis: 0 times +/- inf is nan, which is a failure. 0 times inf is not 0!
- Sometimes rotation matrices are just inconsistent and you cannot solve them
- Except for the last couple of releases, failure if complex values result; the newest couple of releases can fsolve() on complex-valued expressions
How to fix Failure in initial objective function evaluation
11 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Hello, I'm trying to evaluate function
f_gamma_r_delta_v = @(x,beta) [...
Px+Q*cos(phi0+beta)+x(2)*cos(gamma0+x(1));
Q*sin(phi0+beta)+x(2)*sin(gamma0+x(1));
S*cos(gamma0+x(1))+U*cos(delta0+x(3))+Wx;
S*sin(gamma0+x(1))+U*sin(delta0+x(3))+x(4)];
using fsolve
[x,fval]=fsolve(f_gamma_r_delta_v,x0,options,beta);
gamma(i)=x(1)*180/pi;
R(i)=x(2);
delta(i)=x(3)*180/pi;
V(i)=x(4);
x0=x;
but I can not fix the Failure in initial objective function evaluation although I've read some answered questions.
Error in fsolve (line 230)
Thank you very much for help.
Marek
0 commentaires
Réponses (2)
Walter Roberson
le 8 Avr 2018
You would get a failure if:
I notice, by the way, that the code after that uses i as a vector index. Be careful: by default i is sqrt(-1) . To avoid confusion and make sure you do not accidentally index at sqrt(-1) it is better practice to avoid using i or j as variable names.
0 commentaires
Marek Majkut
le 8 Avr 2018
1 commentaire
Walter Roberson
le 8 Avr 2018
You could run the code up to that point and save the variables in a .mat file and attach that with minimal code to reproduce the problem from there.
By the way, please see
You are using an undocumented feature of fsolve when you pass in beta the way you are.
Voir également
Catégories
En savoir plus sur Filter Analysis dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!