MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Asked by Fred
on 30 Nov 2012

I was optimizing a function named ML with fmincon to find the parameter "theta",

twostage = fmincon(@(theta)ML(theta,param,x,y),theta,[],[],[],[],lb,ub,[],options);

now I want to optimize another function ML2 for two parameters "theta1" and "theta2", can fmincon optimize a function for 2 parameters? how should I write the function?

Thanks

Answer by Matt J
on 30 Nov 2012

Edited by Matt J
on 30 Nov 2012

Accepted answer

Make theta a 2x1 vector instead and rewrite ML accordingly, to interpret theta as a 2x1 input vector. Also make ub and lb 2x1.

Fred
on 30 Nov 2012

thanks so you mean I should use theta(1) and theta(2) instead of theta1 and theta2 in ML function

## 0 Comments