Youcha
Youcha

Reputation: 1564

Minimize a function with respect to some variables

I have a function

function [result] = mleGARCH1(r,a0,a1,b1,mu)

which I want to minimize with respect to all the variables apart from r which will be an input.

How should I format the fminsearch function to obtain that?

Upvotes: 1

Views: 893

Answers (1)

Dan Becker
Dan Becker

Reputation: 1214

Try an anonymous function:

[xmin result] = fminsearch(@(x) mleGARCH1(r,x(1),x(2),x(3),x(4)), [ initial values ]);

Upvotes: 3

Related Questions