Drexel dragonThe Math ForumDonate to the Math Forum



Search All of the Math Forum:

Views expressed in these public forums are not endorsed by Drexel University or The Math Forum.


Math Forum » Discussions » Software » comp.soft-sys.matlab

Topic: fzero command error
Replies: 3   Last Post: Jun 12, 2014 2:44 PM

Advanced Search

Back to Topic List Back to Topic List Jump to Tree View Jump to Tree View   Messages: [ Previous | Next ]
Radu Bogdan

Posts: 2
Registered: 6/10/14
fzero command error
Posted: Jun 10, 2014 3:11 PM
  Click to see the message monospaced in plain text Plain Text   Click to reply to this topic Reply

Hello, I am trying to solve an equation using the fzero command and keep getting the following error:

------------------------------------------------------------------------------------------------------------------------
"Operands to the || and && operators must be convertible to logical scalar values.
Error in fzero (line 308)
elseif ~isfinite(fx) || ~isreal(fx)
Error in buck_charge_test_d (line 27)
D=fzero(@(x) d_charge(x,u,A1,B1,A2,B2,Ts,Vref),0.2),"
------------------------------------------------------------------------------------------------------------------------
Now, the function d_charge I use in the main program is the following:
------------------------------------------------------------------------------------------------------------------------
function y=d_charge(x,E,A1,B1,A2,B2,Ts,Vref)
I=eye(3); extr=[0 0 1];
phi1=expm(A1*x*Ts); psi1=inv(A1)*(phi1-I)*B1;
phi2=expm(A2*(1-x)*Ts); psi2=inv(A2)*(phi2-I)*B2;
y=(extr*phi1*inv(I-phi2*phi1)*(phi2*psi1+psi2)+psi1)*E-Vref;
------------------------------------------------------------------------------------------------------------------------
All the variables in the function have been defined and assigned values.
So when I try to execut the function above using the following command line :
D=fzero(@(x) d_charge(x,u,A1,B1,A2,B2,Ts,Vref),0.2),
I always get that error.

Can someone help me ? Thank you in advance.

P.S. If the initialization of the variables and matrixes are needed for better comprehension I will add them ( didn't put them here so this post won't be too big)



Point your RSS reader here for a feed of the latest messages in this topic.

[Privacy Policy] [Terms of Use]

© Drexel University 1994-2014. All Rights Reserved.
The Math Forum is a research and educational enterprise of the Drexel University School of Education.