# Find maximum of a function.

4 views (last 30 days)

Show older comments

Dear all,

I have the following code that aims at maximixing LL_all with respect to "gidraw" which is scalar.

%the data

n=1;

Xfi=[ -1.4+randn(n,1) 0.5+0.6*randn(n,1)];

beta=[3 2 ]';

yi=randn(n) ;

gidraw=0.5;

lam=Xfi*beta + gidraw;

int=yi.*lam-exp(lam);

int=sum(int);

%the function

LL_all = -(log(normpdf(gidraw,2,sqrt(0.5)))+int);

So, my question is what is the maximum of LL_all? That is, how can I find the maximum of this function? Also can I calculate the Hessian matrix(which is a scalar more precisely) of this function?

Thanks in advance

##### 4 Comments

Walter Roberson
on 19 Aug 2015

### Accepted Answer

JMP Phillips
on 19 Aug 2015

##### 2 Comments

JMP Phillips
on 20 Aug 2015

### More Answers (0)

### See Also

### Categories

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!