write function for using optimization app
Mostrar comentarios más antiguos
i try to use function for optimization app and i keep getting same error
Error: Expression or statement is incorrect--possibly unbalanced (, {, or [.
this is my code
function [f,w1,w2,beta0,beta1,gamma0,gamma1,a,b,x,y]=myfun(p)
%every equation must name in function
w1 = normrnd(0,1,[1 100]);
w2 = normrnd(0,1,[1 100]);
beta0 = 0.5;
beta1 = 1;
gamma0= 0.5;
gamma1= 1;
a = exp(beta0 +beta1.*w1);
b = exp(gamma0+ gamma1.*w2);
x = exprnd(a);
y = exprnd(b);
f= exp(p(1)+p(2).*w1-p(3)-p(4).w2 )./ (1+exp(p(1)+p(2).*w1-p(3)-p(4).w2));
end
1 comentario
Walter Roberson
el 2 de Dic. de 2017
That code looks okay. Perhaps the problem is in the code you use to call it.
Respuestas (0)
Categorías
Más información sobre Surrogate Optimization en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!