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!