this is my code i am getting error with x = simulannea​lbnd(Objec​tiveFuncti​on,X0,ydat​a,lb,ub). can help me to resolve it

1 次查看(过去 30 天)
function y = parameterized_objective(x,xdata)
y =x(1)./((x(2).*(xdata.^(1+0.9)))+x(3).*(xdata.^(0.9))+1);
ydata=(0.2575./((xdata.^2)+(0.333.*xdata)+1));
xdata =[ 10.^(-5) 10.^(-4) 10.^(-3) 10.^(-2) 10.^(-1) 1] ;
ObjectiveFunction = @(x)parameterized_objective(x,xdata);
X0 = [0; 0; 0 ];
lb = [0.2; 0.2; 0.2];
ub = [1; 1; 1];
x = simulannealbnd(ObjectiveFunction,X0,ydata,lb,ub)

采纳的回答

Walter Roberson
Walter Roberson 2017-8-5
The simulannealbnd function does not expect ydata to be passed to it. You might need
ObjectiveFunction = @(x)parameterized_objective(x,xdata,ydata);
x = simulannealbnd(ObjectiveFunction,X0,lb,ub)
having changed parameterized_objective to expect ydata
  5 个评论
Walter Roberson
Walter Roberson 2017-8-6
Your code
function y = parameterized_objective(x,xdata)
y =x(1)./((x(2).*(xdata.^(1+0.9)))+x(3).*(xdata.^(0.9))+1);
does not appear to have a need for ydata. Why was it that you were passing ydata to simulannealbnd ? Were you trying to do a fitting? If so then you should be using
xdata =[ 10.^(-5) 10.^(-4) 10.^(-3) 10.^(-2) 10.^(-1) 1] ;
ydata=(0.2575./((xdata.^2)+(0.333.*xdata)+1));
parameterized_objective = @(x,xdata) x(1)./((x(2).*(xdata.^(1+0.9))) + x(3).*(xdata.^(0.9))+1);
ObjectiveFunction = @(x) sum((parameterized_objective(x,xdata) - ydata).^2);
X0 = [0; 0; 0 ];
lb = [0.2; 0.2; 0.2];
ub = [1; 1; 1];
x = simulannealbnd(ObjectiveFunction, X0, lb, ub)

请先登录,再进行评论。

更多回答(0 个)

类别

Help CenterFile Exchange 中查找有关 Simulated Annealing 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by