# Minimizing a multivariable function with different vector length?

Assume that I want to minimize a function to a measured vector.

$$V_{min} = \sum_{n = 0, k = 0}^{N, K}{|T_n - f(t_n, p_n, r_k)|}$$

Where $T_n, t_n, p_n$ has the same vector length $N$, but not $r_k$ which as the length $K$.

Is there any way to find the best $r_k$ then in MATLAB?

Rigth now I using two for-loops. But it mus be a function for this?

• Why would it make a difference of any sort anyways? In the end, you must be able to describe your objective as $f(x)$, and $x$ is simply all your unknown variables (I am assuming your are using an optimization solver such as fmincon etc) – Johan Löfberg May 24 '18 at 11:10
• @JohanLöfberg Hi! I don't use any optimazation solver. I have some measurement data and I don't know how to minmize if the measurement data is few compared to the tuning parameter. – Daniel Mårtensson May 24 '18 at 11:34
• With little data compared to parameters, you typically regularize the objective using a penalty on the parameters. I don't understand how you intend to minimize something though, without using some sort of optimization strategy. – Johan Löfberg May 24 '18 at 12:44
• The notation is weird also. As it stands now, it says that there are vectors $r$, each with length K, but you also have $K$ of these vectors as you loop over $k$ up to $K$. I suspect you mean $r$ is a vector of length $K$, and $r_k$ is an element in that vector. – Johan Löfberg May 24 '18 at 13:02
• @JohanLöfberg Yes. $r_k$ is a element in the vector and $K$ is the length of the vector. I have not used optimazation methods except that QP-programming for linear MPC. – Daniel Mårtensson May 24 '18 at 13:22