Clear Filters
Clear Filters

fsolve No solution found

8 views (last 30 days)
Ammar Ahmed
Ammar Ahmed on 26 May 2019
Edited: dpb on 29 May 2019
matlab can not solve this nonlinear equation with one variable (ere)
function fval=eqn(ere)
P=(0.27);
er1=(1+1.8*10^14*1i);
er2=(2.5+2.5*10^-3*1i);
Hc=(10^6);
H=[0,2.5*10^4,5.0*10^4,7.5*10^4,1*10^5,1.3*10^5,1.5*10^5];
Pc=(0.33).*exp((-(H)/Hc));
c=(1-3*Pc).*(((P)./(Pc)).^Pc).*(((1-P)./(1-Pc)).^(1-Pc));
fval=((P).*((ere-er1)./(er1-2.*ere)))./((1)+(c).*((ere-er1)./(er1-2.*ere))+((1-P).*((ere-er2)./(er2-2.*ere)))./((1)+(c).*((ere-er2)./(er2-2.*ere))));
end
command use
options = optimoptions('fsolve','Display','iter');
[ere,fval] = fsolve(@eqn,[4.5;7.5],options);
solution not found
fsolve stopped because the last step was ineffective. However, the vector of function
values is not near zero, as measured by the value of the function tolerance.
<stopping criteria details>
fsolve stopped because the sum of squared function values, r, is changing by less
than options.FunctionTolerance = 1.000000e-06 relative to its initial value.
However, r = 4.174916e-03, exceeds sqrt(options.FunctionTolerance) = 1.000000e-03.
  9 Comments
Walter Roberson
Walter Roberson on 27 May 2019
The output is length() of the input by length(H)
"this nonlinear equation with one variable (ere) "
[ere,fval] = fsolve(@eqn,[4.5;7.5],options);
The [4.5;7.5] tells MATLAB that you think it is a system with two variables rather than one.
H=[0,2.5*10^4,5.0*10^4,7.5*10^4,1*10^5,1.3*10^5,1.5*10^5];
Either there is a missing piecewise interpolation, or there is a missing sum() or prod()
dpb
dpb on 27 May 2019
Edited: dpb on 29 May 2019
If response to my "can't figure out", I grok the ML why; perhaps my presumption in writing same that OP understood and intended that was in error... :)
ADDENDUM
The idea that H may be intended as an interpolating vector is a good one, Walter...that hadn't occurred to me but I think you may be thinking in the right direction of where the solution needs to go. But, w/o the correlation he's trying to implement, it's a guess and the crystal ball is murky...as well as my recollections of complex permittivity from 50+ years ago are more than rusty.

Sign in to comment.

Answers (0)

Categories

Find more on Material Sciences in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!