Warning with fsolve
Mostrar comentarios más antiguos
% 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
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
el 23 de Abr. de 2018
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
Más información sobre Logical en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!