Warning: feval on script names will not work, or may work differently error.

3 次查看(过去 30 天)
x0=1 y0=1 z0=1
options=optimset('Display','iter');
[solution,fval] = fsolve(@myfun,[x0,y0,z0],options) % Call solver
eqn1 = @(x0, y0, z0) (-4.71777*10^21)+(2.10263*(10^15)*x0)-(3.49196*(10^8)*(x0^2))+(28*x0^3)+(1.56321*(10^14)*y0)-(3.76035*(10^7)*x0*y0)-(1.16399*(10^8)*y0^2)+(28*x0*y0^2)+(1.11156*(10^15)*z0)-(2.6739*(10^8)*x0*z0)-(1.16399*(10^8)*z0^2)+(28*x0*z0^2);
eqn2 = @(x0, y0, z0) (-7.62057*10^20)+(1.56321*(10^14)*x0)-(1.88017*(10^7)*x0^2)+(1.16012*(10^15)*y0)-(2.32797*(10^8)*x0*y0)+(28*(x0^2)*y0)-(5.64052*(10^7)*y0^2)+(28*y0^3)+(1.7955*(10^14)*z0)-(2.6739*(10^8)*y0*z0)-(1.88017*(10^7)*z0^2)+(28*y0*z0^2);
eqn3 = @(x0, y0, z0) (-5.41882*(10^21)+(1.11156*(10^15)*x0)-(1.33695*(10^8)*x0^2)+(1.7955*(10^14)*y0)-(1.33695*(10^8)*y0^2)+(2.41161*(10^15)*z0)-(2.32797*(10^8)*x0*z0)+(28*(x0^2)*z0)-(3.76035*(10^7)*y0*z0)+(28*(y0^2)*z0)-(4.01085*(10^8)*z0^2)+(28*z0^3));
fun = @(x) [eqn1(x(1), x(2), x(3)); eqn2(x(1), x(2), x(3)); eqn3(x(1), x(2), x(3))];
%it gives this error
Warning: Warning: feval on script names will not work, or may work differently,
in a future version of MATLAB. To make your code insensitive to any change
and to suppress this warning message:
- Either change the script to a function.
- Or use eval instead of feval.
The script file in question is myfun.
> In fsolve at 241
In positioning_by_ranging at 11
Error using feval
Attempt to execute SCRIPT myfun as a function:
C:\Matlab_codes\myfun.m
Error in fsolve (line 241)
fuser = feval(funfcn{3},x,varargin{:});
Error in positioning_by_ranging (line 11)
[solution,fval] = fsolve(@myfun,[x0,y0,z0],options) % Call solver
Caused by:
Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.

采纳的回答

Walter Roberson
Walter Roberson 2014-2-24
What is in myfun.m ? You show us fun being constructed and it would normally be assumed you were going to fsolve fun but you fsolve the unknown myfun instead.

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Just for fun 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by