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!!

Respuestas (2)

Walter Roberson
Walter Roberson el 19 de Feb. de 2012

0 votos

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
Torsten el 23 de Abr. de 2018

0 votos

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.

Categorías

Productos

Preguntada:

el 19 de Feb. de 2012

Respondida:

el 23 de Abr. de 2018

Community Treasure Hunt

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

Start Hunting!

Translated by