fsolve no solution found
4 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
I want to solve several nonlinear equations by using fsolve. The program can not find a solution to most problems while I think there should be a solution. I have tried several input vectors, only when 'a=[0 0 0 0]' that a solution can be found. Please help me! The problem and the program are as below.
No solution found.
fsolve stopped because the problem appears regular as measured by the gradient,
but the vector of function values is not near zero as measured by the
default value of the function tolerance.
<stopping criteria details>
function F = myfun(n)
a=[0.5 0.6 0.7 0.8];
c=[2 1 3 1];
F = 1-prod(exp(-((1./n)*c).^2.39))-a;
clear all, close all, clc;
n0 = rot90(ones(1,4)); % Make a starting guess at the solution
n = fsolve(@myfun,n0);
0 Commenti
Risposte (1)
Walter Roberson
il 25 Ago 2015
My tests show that there are no real-valued solutions to this.
When fully written out, the expression is completely symmetric in all of the n coefficients, so it has a minimum when the coefficients are all equal -- or when at least one is 0 or at least one is infinity. Coefficients of 0 give a division by 0 because of the 1./n so those are not possible. Three coefficients of infinity lead to the same minimum as the case for all coefficients equal.
If you make all of the coefficients equal (call it N), and differentiate the sum of squares of F (an expression that would be 0 for an exact solution), you can plot over the range between N = 0 .. 4, you can see there is a zero crossing near 1. You can fsolve() to get to the location of the minima. Substitute back in to the sum of squares of F and you get about 0.35804 -- the same value that you would get if you did fminsearch() with even a moderate number of random trials. I ran about half a million random trials of positions up to 1E6 and none of the real-valued solutions came out lower than this 0.35804 .
If you are expecting complex solutions then you should not be using fsolve(). (I am not certain there are any complex solutions either; my investigations so far suggest there are none.)
0 Commenti
Vedere anche
Categorie
Scopri di più su Linear Algebra in Help Center e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!