필터 지우기
필터 지우기

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