From: Kyle on 30 Mar 2010 02:09 Can someone explain to me what exactly this means? I have "for loops" and various vector matrices in my code and when I try to use fzero, I get this error. Do I need to modify my "for loops" or something? ??? Operands to the || and && operators must be convertible to logical scalar values.
From: James Tursa on 30 Mar 2010 02:39 "Kyle " <kyle.bm(a)hotmail.com> wrote in message <hos4i0$7ki$1(a)fred.mathworks.com>... > Can someone explain to me what exactly this means? I have "for loops" and various vector matrices in my code and when I try to use fzero, I get this error. Do I need to modify my "for loops" or something? > > ??? Operands to the || and && operators must be convertible to logical scalar values. Impossible to advise without seeing the code that generated this error. James Tursa
From: Kyle on 30 Mar 2010 03:49 Here is my code: x=20 p=30 y=400 z=linspace(5,30,10) x=linspace(1,10,10) j=linspace(3,50,10) f1=z+x+j; fun=@(t)(0.5*x*p*y*(t^2)*((1000^2)/(3600^2)))+f1; x = fzero(fun,1)
From: Steven Lord on 30 Mar 2010 10:08 "Kyle " <kyle.bm(a)hotmail.com> wrote in message news:hosadg$qgv$1(a)fred.mathworks.com... > Here is my code: > > x=20 > p=30 > y=400 > z=linspace(5,30,10) > x=linspace(1,10,10) > j=linspace(3,50,10) > > f1=z+x+j; > fun=@(t)(0.5*x*p*y*(t^2)*((1000^2)/(3600^2)))+f1; > x = fzero(fun,1) > What happens when you call fun with 1, your initial guess for the value of the zero, as input? Does fun return a real scalar value, as FZERO _requires_ of the function you pass into it? If you're looking to solve a _system_ of equations, you need either FMINSEARCH on the sum of the squares of the function values or, even better, FSOLVE from Optimization Toolbox. -- Steve Lord slord(a)mathworks.com comp.soft-sys.matlab (CSSM) FAQ: http://matlabwiki.mathworks.com/MATLAB_FAQ
|
Pages: 1 Prev: about the matlab work Next: simulate a zif receiver(Mixer Problem) |