How to optimize two variable simultaneously in a function?

5 visualizzazioni (ultimi 30 giorni)
Following is the function that I want to optimize for two variable theta1_t and theta2_t. There are no constraints so I tried using the fminunc(), but it gives me an error. atk= exp(-theta2_t*k);
btk= (theta1_t/(theta1_t-theta2_t))*(exp(-theta2_t*k)- exp(-theta1_t*k));
func= (atk*y0)+(btk'*u)+gamma where gamma is known.
I have 165 values of theta1_t and theta2_t. I want to choose the optimum one of them. How can I do this? k ranges from 1 to 165.

Risposta accettata

Alan Weiss
Alan Weiss il 22 Mar 2018
Are you doing curve fitting? I mean, you have a lot of data and you are trying to find the best parameters of an equation that fits the data? If so, see this example. If not, then I don't understand your question, so please explain a bit more, and maybe show some code or at least the complete MATLAB error message.
Alan Weiss
MATLAB mathematical toolbox documentation

Più risposte (0)

Community Treasure Hunt

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

Start Hunting!

Translated by