Filter löschen
Filter löschen

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 Ansicht (letzte 30 Tage)
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)

Akzeptierte Antwort

Walter Roberson
Walter Roberson am 5 Aug. 2017
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 Kommentare
Walter Roberson
Walter Roberson am 6 Aug. 2017
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)

Melden Sie sich an, um zu kommentieren.

Weitere Antworten (0)

Community Treasure Hunt

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

Start Hunting!

Translated by