0

Assume I have a function with 5 variables, and each one have a range constrains. I want to find the minimum of a function, as well as the values of those 5 variables which are needed to obtain that minimum value in that function. I am using the fminsearch.

func = @(x, y, z, k, m) (--some-function-which-depends-to-those-5-variable);

Assume I have above function that I want to minimize.

range_x = [12, 24];
range_y = [13.3, 30.2];
range_z = [1.4, 4.7];
range_k = [1.2, 1.4];
range_m = [4.12, 12.2];

and the above ranges.

??? = fminsearch(@(x) func(x(1), x(2), x(3), x(4), x(5)), ???)

I am currently using fminsearch function. However, I stucked the point that how can I use ranges and how can I extract the min value / and all those 5 variables which gives this result.

Thanks in advance.

1 Answer 1

0

fminsearch as per the documentation, is for unconstrained minimization, i.e. you don't put limits on the variables.

fmincon instead, is for constrained minimization.

Sign up to request clarification or add additional context in comments.

2 Comments

Hello Ander, I do not have constrains on variables depending on each other, and I am having trouble to understand how can I give A and b parameters in my case. Can you explain a bit? Thanks a lot.
The parameters of interests to you are ub and lb. I believe you can just make A and b zero, that makes the constraint true for any x.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.