Prev: Symbolic toolbox solution
Next: Finding a root
From: Walter Roberson on 9 Jul 2010 15:19 Philip M wrote: > fzero(func, 0) > ??? Input argument "rho" is undefined. fzero(@func,0)
From: dpb on 9 Jul 2010 15:35 Philip M wrote: > I put it down like this... > function f = func(rho) ....please do NOT top post... :( --
From: Philip M on 9 Jul 2010 16:53 dpb <none(a)non.net> wrote in message <i17tqp$n24$2(a)news.eternal-september.org>... > Philip M wrote: > > I put it down like this... > > function f = func(rho) > > ...please do NOT top post... :( > > -- sry for top posting... actually if i put it with @func I get the same error message as in the beginning... r=fzero(@func,0) ??? Error using ==> fzero at 317 FZERO cannot continue because user supplied function_handle ==> func failed with the error below. SIGMA must be symmetric and positive definite.
From: Walter Roberson on 9 Jul 2010 17:22 Philip M wrote: > actually if i put it with @func I get the same error message as in the > beginning... > > r=fzero(@func,0) > ??? Error using ==> fzero at 317 > FZERO cannot continue because user supplied function_handle ==> func > failed with the error below. > > SIGMA must be symmetric and positive definite. In the beginning you had no calls at all to fzero, so how can this be "the same error message as in the beginning" ?? The error messages you have previously quoted have been about values not being defined. Your current problems are in your mvncdf calls. Your sigma matrix is [1 -tmp; -tmp 1] where tmp is sqrt(1-rho) . Now, is this sigma matrix positive definite? That is going to depend upon the allowed range for rho. If rho can be less than or equal to zero, then temp could be 1 or greater, and sigma would then have an eigenvalue that is 0 or negative (in particular 1-tmp would be an eigenvalue), and the sigma matrix would then not be positive definite as required by mvncdf().
From: dpb on 9 Jul 2010 17:29
Philip M wrote: > dpb <none(a)non.net> wrote in message > <i17tqp$n24$2(a)news.eternal-september.org>... >> Philip M wrote: >> > I put it down like this... >> > function f = func(rho) >> >> ...please do NOT top post... :( >> >> -- > > sry for top posting... Sorry to be so adamant, but it really does make following a thread, particularly one w/ code and other detail much more difficult than otherwise. > actually if i put it with @func I get the same error message as in the > beginning... > > r=fzero(@func,0) > ??? Error using ==> fzero at 317 > FZERO cannot continue because user supplied function_handle ==> func > failed with the error below. > > SIGMA must be symmetric and positive definite. Well, that's different and has to do w/ the formulation of the function, not fzero() call, per se. Going back and looking, for SIGMA, we find-- sigma = [1 -tmp; -tmp 1]; for i=1:20, p(i) = mvncdf([x,c(i)], 0, sigma); q(i) = mvncdf([z,c(i)], 0, sigma); I don't have the toolbox for mvncdf but your error says "you can't do that"--you'll have to look at the documentation for that function to see why and what you need to do to get what you are expecting. -- |