arrays - matrix in function, fzero not working -



arrays - matrix in function, fzero not working -

there lot of variables here bear me. after debugging etc. of variables working fine except tinf assume other variables constant. tinf defined as

tinf=34.5*cos((2*pi).*(t-5))+275.5

which function of t t is

t=linspace(0,50,600)

i trying calculate

t(1)=fzero(fun_partridge,0)

where

fun_partridge=@(x) ((i(1).^2).*rprime(1))+(alpha.*d(1).*gs)-(o*e*pi.*d(1).*(x.^4-tinf.^4))-(h*pi.*d(1).*(x-tinf))

(remember other variables working , hence constants, variables matrices 2 columns of 1 value each)

everything runs fine until

t(1)=fzero(fun_partridge,0)

and error message:

" operands || , && operators must convertible logical scalar values.

error in fzero (line 308) elseif ~isfinite(fx) || ~isreal(fx)

error in maxsag_take_2 (line 102) t(1)=fzero(fun_partridge,0); "

i much beginner when comes matlab please don't hesitate dumb things downwards bit. in advance!

without knowing size, shape, , type other variables are, it's hard say, based on error message, fx should scalar , it's coming out vector, means you're passing fzero doesn't like.

i not have matlab in front end of me right now, looking @ fun_partridge function, doing matrix multiplication of variables, , element-wise multiplication of others. if o and/or e vectors, may ending matrix instead of vector function, which, if fzero constructing fx using function sum, yield vector instead of scalar, causing short-circuit behavior of && , || choke.

in add-on @nkn's comment above, seek executing size(fun_partridge(1)) , see if out vector or matrix.

arrays matlab matrix anonymous

Comments

Popular posts from this blog

assembly - What is the addressing mode for ld, add, and rjmp instructions? -

vowpalwabbit - Interpreting Vowpal Wabbit results: Why are some lines appended by "h"? -

Is there a way to convert an HTML page styled with Bootstrap CSS into email-compatible html? -