write function for using optimization app
Afficher commentaires plus anciens
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 commentaire
Walter Roberson
le 2 Déc 2017
That code looks okay. Perhaps the problem is in the code you use to call it.
Réponses (0)
Catégories
En savoir plus sur Surrogate Optimization dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!