Warning with fsolve
Afficher commentaires plus anciens
% 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!!
Réponses (2)
Walter Roberson
le 19 Fév 2012
0 votes
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
le 23 Avr 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.
Catégories
En savoir plus sur Logical dans Centre d'aide et File Exchange
Produits
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!