Questions tagged [fminsearch]

For questions about the Matlab function fminsearch that computes the unconstrained minimum of a given function with the Nelder-Mead algorithm.

SYNOPSIS

x = fminsearch ( costf , x0 )
x = fminsearch ( costf , x0 , options )
[x,fval,exitflag,output] = fminsearch ( costf , x0 , options )

Description

This function searches for the unconstrained minimum of a given cost function.

The provided algorithm is a direct search algorithm, i.e. an algorithm which does not use the derivative of the cost function. It is based on the update of a simplex, which is a set of k>=n+1 vertices, where each vertex is associated with one point and one function value. This algorithm is the Nelder-Mead algorithm.

source

122 questions
1
vote
0 answers

Understanding optimization problems and solving them in Matlab (choise of appropriate solver)

Maybe a classical phrase: I have been trying to understand this since several days but not succeed - really about me! Lets take a simple constrained optimization problem from here maximizing revenue with budget constraints. So the problem is We can…
Yurii
  • 13
  • 4
1
vote
1 answer

Why does the rowsize of A matter in fmincon

I have a Matlab code, which use fmincon with some constraints. So that I am able to modify the code I have thought about whether the line position within the condition matrix A makes a difference I set up a test file so I can change some variables.…
Martin
  • 312
  • 2
  • 15
1
vote
1 answer

Translating Matlab @ into Python code (RuntimeWarning: invalid value encountered in true_divide )

I'm translating a Matlab code to python and I got stuck here. I think that with @ it's creating a local variable right? I tried to traduce the code with nested function but it seems to have a problem in hanfling one of the variable. #Code's…
Giovanni Frison
  • 628
  • 3
  • 19
1
vote
1 answer

Using fmin with random forest regression

I'm trying to use the scipy fmin function on a random forest regression model of an example dataset. The model works well, but when I try the fmin function with an initial guess np.zeros(8), I get this error: ValueError: Expected 2D array, got 1D…
1
vote
2 answers

Dynamically choose variables to be minimized in multidimensional optimization

In Matlab, I know how to program a multidimensional optimization. But I would like to dynamically choose a subset of variables to be optimized. Suppose I have a three-dimensional variable vector, but I want Matlab to only optimize the first and the…
winkmal
  • 622
  • 1
  • 6
  • 16
1
vote
1 answer

scipy.optimize.fim Error: need more than 1 value to unpack

I know that there are plenty of posts similar to mine but I really don't manage to apply them to my situation so please I ask for your help. Basically, my code is the following: def Black_min(f, k, ann, vol, ex, cp): …
AndrewTG
  • 43
  • 4
1
vote
1 answer

Optimizing for more than one argument in Matlab

Consider the following Matlab function function [f, dfx1, dfx2] = optifun(x1,x2) f = x1(1)^2 + x1(2)^2 + x2^2; % Gradients dfx1(1) = 2*x1(1); dfx1(2) = 2*x1(2); dfx2 = 2*x2; My objective is to optimize the above function with respect to x1 and…
pkj
  • 559
  • 1
  • 9
  • 21
1
vote
0 answers

Matlab Optimization Minsearch

I am running an optimization problem on a multidimensional surface with unknown derivatives, and no closed form equation. It's problem motivated by an econ paper that tries to value a patent by the future stochastic revenues it generates. Its a…
jessica
  • 1,325
  • 2
  • 21
  • 35
1
vote
1 answer

MATLAB's fminsearch terminates with no reason after SAP2000 API analysis is completed

I am trying to optimize my numerical model of structure made by SAP2000 v18.1. for this purpose, I obtained API functions in MATLAB and tried to do the optimization by the fminsearch function. MATLAB opens the model, makes the modifications and runs…
1
vote
1 answer

Calling fmincon from Simulink

I am trying to implement a particular type of model predictive control in the Simulink-Matlab framework. To do so, my plan was to have the dynamic model in Simulink call an external Matlab S-function which in turns runs an optimization that calls a…
Enrico Anderlini
  • 447
  • 6
  • 21
1
vote
0 answers

MATLAB: Fitting parameters when input is a function

So sorry to ask this naive question, but I really get stuck as an absolute MATLAB newbie. Below is what I am trying to do. I have a model that takes coin flip outcomes as its input: function randomness = benHMMN(flips,rep,prior) % defined…
ramund
  • 185
  • 11
1
vote
1 answer

Using fminsearch to perform distribution fitting

Suppose I have a set of univariate data held in the array errors. I would like to fit a PDF to my observed data distribution. My PDF is defined in a function poissvmwalkpdf, whose definition line looks like this: function p = poissvmwalkpdf(theta,…
abcd
  • 10,215
  • 15
  • 51
  • 85
1
vote
1 answer

Matlab Transform old school min find into fminsearch

My code is the following. I was told fminsearch would solve this faster. I checked the docs and tutorials but I'm still in the dark. How would you implement fminsearch here? Thanks in advance. MIN=1e10; up_vec= u_min1+ ku*lambda; …
Mike
  • 552
  • 3
  • 18
1
vote
1 answer

fminsearch for non linear regression Matlab?

Can anyone explain to me how I can apply fminsearch to this equation to find the value of K (Diode Equality Factor) using the Matlab command window. I = 10^-9(exp(38.68V/k)-1) I have data values as follows: Voltage := [0, 0.1, 0.2, 0.3, 0.4, 0.5,…
1
vote
0 answers

Getting the number of function calls of fminsearch for each iteration

options = optimset('Display','iter','MaxIter',3,'OutputFcn',@outfun); [x,fval,~,output] = fminsearch(@(param) esm6(param,identi),result(k,1:end-1),options); This code will find the local Minimum of my esm6 function and due to the 'Display' Option…
Max
  • 1,471
  • 15
  • 37
1 2
3
8 9