how to solve this? :-/

3 次查看(过去 30 天)
crossmath
crossmath 2015-3-28
编辑: crossmath 2015-3-29
Not enough input arguments.
Error in fsolve (line 243) fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue. I write in cw: [y,fval,exitflag]=fsolve(@(ca,cc,cp)koncas(ca,cc,cp),[1;1;1;1;1;0;0;0;0;0;0;0]) function: function [ y] = koncas( ca,cc,cp) %UNTITLED Summary of this function goes here % Detailed explanation goes here
y=[2.2-0.53*ca(1)-24*ca(1)^2-ca(1)-8.5*ca(1)*cc(1)^2+0.7*cp(1)^3 0.364-0.44*ca(1)-1.44*ca(2)-24*ca(2)^2-ca(2)-8.5*ca(2)*cc(2)^2+0.7*cp(2)^3 0.3+1.1*ca(2)-1.85*ca(3)-24*ca(3)^2-ca(3)-8.5*ca(3)*cc(3)^2+0.7*cp(3)^3 0.25+1.54*ca(3)-2.15*ca(4)-24*ca(4)^2-ca(4)-8.5*ca(4)*cc(4)^2+0.7*cp(4)^3 36*ca(1)^2-17*ca(1)*cc(1)^2+2.1*cp(1)^3-0.533*cc(1) 0.44*cc(1)+36*ca(2)^2-17*ca(2)*cc(2)^2+2.1*cp(2)^3-1.33*cc(2) 1.11*cc(2)+36*ca(3)^2-17*ca(3)*cc(3)^2+2.1*cp(3)^3-1.85*cc(3) 1.54*cc(3)+36*ca(4)^2-17*ca(4)*cc(4)^2+2.1*cp(4)^3-1.33*cc(4) 8.5*ca*(1)*cc(1)^2-0.7*cp*(1)^3-0.53*cp(1) 0.44*cp(1)+8.5*ca*(2)*cc(2)^2-0.7*cp*(2)^3-1.6*cp(2) 1.11*cp(2)+8.5*ca*(3)*cc(3)^2-0.7*cp*(3)^3-1.85*cp(3) 1.54*cp*(3)+8.5*ca*(4)*cc(4)^2-0.7*cp*(4)^3-2.15*cp(4)];
end

采纳的回答

Andrei Bobrov
Andrei Bobrov 2015-3-28
>> out = @(c)[2.2-0.53*c(1)-24*c(1)^2-c(1)-8.5*c(1)*c(5)^2+0.7*c(9)^3
0.364-0.44*c(1)-1.44*c(2)-24*c(2)^2-c(2)-8.5*c(2)*c(6)^2+0.7*c(10)^3
0.3+1.1*c(2)-1.85*c(3)-24*c(3)^2-c(3)-8.5*c(3)*c(7)^2+0.7*c(11)^3
0.25+1.54*c(3)-2.15*c(4)-24*c(4)^2-c(4)-8.5*c(4)*c(8)^2+0.7*c(12)^3
36*c(1)^2-17*c(1)*c(5)^2+2.1*c(9)^3-0.533*c(5)
0.44*c(5)+36*c(2)^2-17*c(2)*c(6)^2+2.1*c(10)^3-1.33*c(6)
1.11*c(6)+36*c(3)^2-17*c(3)*c(7)^2+2.1*c(11)^3-1.85*c(7)
1.54*c(7)+36*c(4)^2-17*c(4)*c(8)^2+2.1*c(12)^3-1.33*c(8)
8.5*c(1)*c(5)^2-0.7*c(9)^3-0.53*c(9)
0.44*c(9)+8.5*c(2)*c(6)^2-0.7*c(10)^3-1.6*c(10)
1.11*c(10)+8.5*c(3)*c(7)^2-0.7*c(11)^3-1.85*c(11)
1.54*c(11)+8.5*c(4)*c(8)^2-0.7*c(12)^3-2.15*c(12)];
>> [y,fval,exitflag]=fsolve(out,[1;1;1;1;1;0;0;0;0;0;0;0])
Solver stopped prematurely.
fsolve stopped because it exceeded the function evaluation limit,
options.MaxFunEvals = 1200 (the default value).
y =
0.20065
0.058511
0.07038
0.063761
0.97025
0.35516
0.26666
0.33071
1.0389
0.30338
0.19623
0.16406
fval =
0.1061
0.0075983
0.0076484
0.003788
0.075537
0.010968
0.010028
0.0078918
0.27012
0.014878
0.010971
0.0056434
exitflag =
0
>>
  1 个评论
crossmath
crossmath 2015-3-29
编辑:crossmath 2015-3-29
It's working when i type this in CW, but when I type it in function file and try to call it it's still problem
>> [y]=fsolve(@konas2,[1;1;1;1;0;0;0;0;0;0;0;0]) Error using feval Output argument "y" (and maybe others) not assigned during call to "C:\Users\Dunja\konas2.m>konas2".
Error in fsolve (line 243) fuser = feval(funfcn{3},x,varargin{:});
Caused by: Failure in initial user-supplied objective function evaluation. FSOLVE cannot continue.

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Solver Outputs and Iterative Display 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by