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
7
votes
1 answer

Estimating the parameters of a custom distribution using mle()

I have the following code that I wish to estimate the parameters of a custom distribution. For more details on the distribution. Then using the estimated parameters I want to see if the estimated PDF resembles the distribution of the given the data…
nashynash
  • 375
  • 2
  • 19
7
votes
1 answer

How to return cost, grad as tuple for scipy's fmin_cg function

How can I make scipy's fmin_cg use one function that returns cost and gradient as a tuple? The problem with having f for cost and fprime for gradient, is that I might have to perform an operation twice (very costly) by which the grad and cost is…
IssamLaradji
  • 6,637
  • 8
  • 43
  • 68
5
votes
2 answers

Passing a constant to fminsearch

How can I pass a constant to fminsearch? So like, if I have a function: f(x,y,z), how can I do an fminsearch with a fixed value of x? fminsearch(@f, [0,0,0]); I know I can write a new function and do an fminsearch on it: function returnValue =…
sooprise
  • 22,657
  • 67
  • 188
  • 276
4
votes
1 answer

How to automatically find proper initial values for fmincon?

I am trying to minimize a target function with nonlinear constrains. My problem is to conveniently find a proper initial value set for the parameters. Because the initial values must satisfy the nonlinear constrains, too, however, in my objective…
4
votes
1 answer

Synchronize intersection points of two pairs of curves with fminsearch

I have two pairs of curves and every pair has an intersection point at a different time value (x-value). Now I need to move one curve of each pair equally in x-direction until both intersection points have the same time value/x-argument: These are…
Robert Seifert
  • 25,078
  • 11
  • 68
  • 113
3
votes
1 answer

fminsearch in R is worse than in Matlab

There is my data (x and y columns are relevant): https://www.dropbox.com/s/b61a7enhoa0p57p/Simple1.csv What I need is to fit the data with the polyline. Matlab code that does this is: spline_fit.m: function [score, params] = spline_fit (points, x,…
3
votes
2 answers

Matlab fminsearch options/restrictions

I have this function in Matlab which is supposed to find the smallest value possible for minValuePossible, by varying the two initial set values of inValues. How can I set the fmin search function to NOT try negative values while trying to find the…
thomashs87
  • 59
  • 2
  • 4
2
votes
0 answers

in Octave: Is there a way of constraining a couple of parameters (not all) in a minimizer like fminsearch?

I'm trying to find the optimal fit of a function based on a couple of parameters. I do this in steps to get full functionality and best fit. However... some times I see that 2 of the parameters are way off what they should be. I'm wondering how…
Michael L
  • 43
  • 3
2
votes
1 answer

fmin_slsqp returns initial guess finding the minimum of cubic spline

I am trying to find the minimum of a natural cubic spline. I have written the following code to find the natural cubic spline. (I have been given test data and have confirmed this method is correct.) Now I can not figure out how to find the minimum…
Thomas Mc Donald
  • 407
  • 1
  • 5
  • 11
2
votes
1 answer

How to use fminsearch to find local maximum?

I would like to use fminsearch in order to find the local maximum of a function. Is it possible to find local maximum using fminsearch with "just" searching on the negative return value of the function. for example: function f = myfun(x,a) f =…
DeJaVo
  • 3,091
  • 2
  • 17
  • 32
2
votes
3 answers

How to let fminsearch only search over integers?

I'm using the fminsearch Method of Matlab to minimize a function: c = cvpartition(200,'KFold',10); minfn = @(z)kfoldLoss(fitcsvm(cdata,grp,'CVPartition',c,... 'KernelFunction','rbf','BoxConstraint',exp(z(2)),... …
machinery
  • 5,972
  • 12
  • 67
  • 118
2
votes
1 answer

Fminsearch Matlab (Non Linear Regression )

Can anyone explain to me how I can apply non linear regression to this equation t find out K using the matlab command window. I = 10^-9(exp(38.68V/k)-1). Screenshot of Equation I have data values as follows: Voltage := [0, 0.1, 0.2, 0.3, 0.4, 0.5,…
Saavin
  • 59
  • 8
2
votes
1 answer

fminsearch error: DOUBLE cannot convert the input expression into a double array

I am encountering a problem during an optimization exercise. I am trying to use fminsearch() in matlab to solve it. The following error is generated when the code is run: The following error occurred converting from sym to double: Error using…
pvl
  • 194
  • 1
  • 10
2
votes
2 answers

Finding the shift of a vector which minimizes the difference to another vector

I am very sorry if similar question was asked before. I have two vectors of 50 x n, and want to find the shift of the first vector, which provides the closest match with the second vector. I have tried fminsearch and circshift in Matlab, however,…
Tethus
  • 23
  • 2
2
votes
2 answers

efficient algorithm to find minimum of multivariable function

I have a multivariable function that I wish to minimize. The function has two input arguments, a vector c and a scalar \theta. Using fmincon in MATLAB to solve the optimization problem for both c and \theta is complicated because certain values of…
user157279
  • 67
  • 4
1
2 3
8 9