Prev: SUPERVISED LEARNING ALGORITHM
Next: Newbie Newey-West
From: Vyjayanthi A on 28 Apr 2010 17:52 Whenever I run the file for the first time I get the error as: ??? Operands to the || and && operators must be convertible to logical scalar values. Error in ==> fzero at 333 elseif ~isfinite(fx) || ~isreal(fx)
From: David Young on 28 Apr 2010 18:06 If fx is a matrix or vector, isreal and isfinite return matrices or vectors, with one element for each element of fx. However, the logical operators && and || need scalar values. Maybe you mean something like ~all(isfinite(fx)) || ~all(isreal(fx))
From: Walter Roberson on 28 Apr 2010 18:08 Vyjayanthi A wrote: > Whenever I run the file for the first time I get the error as: > ??? Operands to the || and && operators must be convertible to logical > scalar values. > Error in ==> fzero at 333 elseif ~isfinite(fx) || ~isreal(fx) The function you passed to fzero, in combination with the initial parameters, produced a multi-dimensional matrix of results instead of a single result (or at most a vector of results, and the vector of results possibility is almost certain to give you the wrong answer.) Double check that in the function you pass to fzero, that you use element-wise operations such as .* and .^ instead of matrix operations such as * and ^
|
Pages: 1 Prev: SUPERVISED LEARNING ALGORITHM Next: Newbie Newey-West |