Warning with fsolve
古いコメントを表示
% My code:
clear all;clc;
feq = @(x) (4e4 - 1.1*x(1)^0.91*4e4^0.091)/200 - x(2);
integrand = @(t) t*((4e4-200*t)/(x(1)*1.1))^10;
seq = @(x) 640*pi*quad(integrand, 0, x(2)) - 4e6;
ceq = [feq;seq];
initial = [25000;35];
options = optimset('Display', 'iter');
[ub,fval] = fsolve(ceq, initial, options);
Error using vertcat
Nonscalar arrays of function handles are not allowed; use cell arrays instead.
% After changing ceq = [feq;seq]; to ceq = {feq;seq};
Warning: Jacobian function provided but OPTIONS.Jacobian='off';
ignoring Jacobian function and using finite-differencing.
Rerun with OPTIONS.Jacobian='on' to use Jacobian function.
> In lsqfcnchk at 97
In fsolve at 223
Warning: Trust-region-dogleg algorithm of FSOLVE cannot handle
non-square systems; using Levenberg-Marquardt algorithm instead.
> In fsolve at 305
I need your help!!
Thanks!!
回答 (2 件)
Walter Roberson
2012 年 2 月 19 日
0 投票
Are you wanting to use Jacobians, or not?
If you are wanting to use Jacobians, then the single function handle you pass in to fsolve() must return multiple values. You do not pass in multiple function handles.
Are you trying to solve more than one equation at a time? If so then they have to be in the same routine, not handled by passing in multiple handles.
Torsten
2018 年 4 月 23 日
fun=@(x)[(4e4 - 1.1*x(1)^0.91*4e4^0.091)/200 - x(2); 640*pi*quad(@(t)t.*((4e4-200*t)/(x(1)*1.1))^10, 0, x(2)) - 4e6];
initial = [25000;35];
options = optimset('Display', 'iter');
[ub,fval] = fsolve(fun, initial, options);
Best wishes
Torsten.
カテゴリ
ヘルプ センター および File Exchange で Logical についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!