From: Vinz A on 4 Aug 2010 17:08 Hi all, Can somebody please please to solve the below error. Iam not using any logical opertors in my program, but still this error pops up when I open the matlab and it for first; when I run for the 2nd time, it gives me correct results. I really have no clue why this error messages comes up for the first time. I have also check my values none of them is a neagative values. ?? Operands to the || and && operators must be convertible to logical scalar values. Error in ==> fzero at 333 elseif ~isfinite(fx) || ~isreal(fx) Error in ==> BRALHX_Condenser_Equations at 74 Fdel=fzero(Fun,1.4766e-007,options); Error in ==> odearguments at 110 f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0. Error in ==> ode15s at 228 [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... Is there a way to know what exactly, the error mean??/ My program is too long to post it. Cheers VJ
From: us on 4 Aug 2010 17:16 "Vinz A" <vinzav(a)gmail.com> wrote in message <i3ckrk$1m0$1(a)fred.mathworks.com>... > Hi all, > > Can somebody please please to solve the below error. > Iam not using any logical opertors in my program, but still this error pops up when I open the matlab and it for first; when I run for the 2nd time, it gives me correct results. I really have no clue why this error messages comes up for the first time. > I have also check my values none of them is a neagative values. > > ?? Operands to the || and && operators must be convertible to logical scalar values. > > Error in ==> fzero at 333 > elseif ~isfinite(fx) || ~isreal(fx) > > Error in ==> BRALHX_Condenser_Equations at 74 > Fdel=fzero(Fun,1.4766e-007,options); > > Error in ==> odearguments at 110 > f0 = feval(ode,t0,y0,args{:}); % ODE15I sets args{1} to yp0. > > Error in ==> ode15s at 228 > [neq, tspan, ntspan, next, t0, tfinal, tdir, y0, f0, odeArgs, odeFcn, ... > > Is there a way to know what exactly, the error mean??/ > My program is too long to post it. > > Cheers > VJ how can CSSMers possibly be of any help with this quickly spewed collection of error messages(?)... try to provide the most parsimonious snippet of ML code, which reproduces this error... us
From: Jan Simon on 4 Aug 2010 18:27 Dear Vinz, > Can somebody please please to solve the below error. The debugger can. A newsgroup can't. > ?? Operands to the || and && operators must be convertible to logical scalar values. > Error in ==> fzero at 333 > elseif ~isfinite(fx) || ~isreal(fx) > Is there a way to know what exactly, the error mean??/ The message means, that fx is not a scalar. Now let the debugger stop in the failing line and inspect, why fx is not a scalar: dbstop if error Good luck, Jan
From: Steven_Lord on 5 Aug 2010 09:58 "Vinz A" <vinzav(a)gmail.com> wrote in message news:i3ckrk$1m0$1(a)fred.mathworks.com... > Hi all, > > Can somebody please please to solve the below error. > Iam not using any logical opertors in my program, but still this error > pops up when I open the matlab and it for first; when I run for the 2nd > time, it gives me correct results. I really have no clue why this error > messages comes up for the first time. > I have also check my values none of them is a neagative values. > > ?? Operands to the || and && operators must be convertible to logical > scalar values. > > Error in ==> fzero at 333 > elseif ~isfinite(fx) || ~isreal(fx) > > Error in ==> BRALHX_Condenser_Equations at 74 > Fdel=fzero(Fun,1.4766e-007,options); What requirements does FZERO have for the objective function you pass into it as the first input argument? http://www.mathworks.com/access/helpdesk/help/techdoc/ref/fzero.html "fun is the function whose zero is to be computed. It accepts a vector x and returns a scalar f, the objective function evaluated at x." The most important word in that quote is SCALAR. If your function returns a NON-scalar value, you will receive this error. If you're trying to solve a system of equations, rather than one equation, you will need to use FSOLVE from Optimization Toolbox instead of FZERO. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ To contact Technical Support use the Contact Us link on http://www.mathworks.com
|
Pages: 1 Prev: Matlab & Threads ? Next: Matrix Generation without For loop |