Error encountered using 'fzero'
Mostra commenti meno recenti
Hello, I have a question regarding fzero. my code is as follows:
syms P
N=-P;
a=50; b=20; h0=50; E=200;n=1.5;
h1=40;
l=100;
I0=b*h0^3/12; I1=b*h1^3/12;
L0=sqrt(P/(E*I0-P*n));%L0=simplify(L00);
L1=sqrt(P/(E*I1-P*n));%L1=simplify(L11);
v=0.3;
s=0.5;
f=1.93-3.07*s+14.53*s^2-25.11*s^3+25.8*s^4;
k=(E*I1)/(6*pi*h1*f*(1-v^2));
m=(E*I1+n*N)/N;
x=(E*I1+n*N)/(E*I0+n*N);
a11=(L0*a)-sin(L0*a);
a12=cos(L0*a)-1;
a13=(-tan(L1*l)*cos(L1*a))+sin(L1*a)-(a*(m*L1^3+L1)*((tan(L1*l)*sin(L1*l))+cos(L1*l)));
a14=1;
a21=(-L0*cos(L0*a))+L0+((E*I0+n*N)*L0^2*sin(L0*a));
a22=(-L0*cos(L0*a))-((E*I0+n*N)*L0^2*cos(L0*a));
a23=(k*L1*((tan(L1*l)*sin(L1*a))+cos(L1*a)))-((m*L1^3+L1)*((tan(L1*l)*sin(L1*l))+cos(L1*l)));
a24=0;
a31=L0^2*sin(L0*a);
a32=-L0^2*cos(L0*a);
a33=x*L1^2*((tan(L1*l)*cos(L1*a))-sin(L1*a));
a34=0;
a41=L0^3*cos(L0*a);
a42=L0^3*sin(L0*a);
a43=-x*L1^3*((tan(L1*l)*sin(L1*a))+cos(L1*a));
a44=0;
A=[a11 a12 a13 a14;a21 a22 a23 a24;a31 a32 a33 a34;a41 a42 a43 a44];
delta1=det(A);
delta2=subs(delta1);
delta=simplify(delta2);
% P=vpasolve(delta,P,1e3);
F=matlabFunction(delta);
P1=[];
for j = 0.01:10
PP = fzero(F, j);
P1 = [P1; PP];
end
P_cr = min(P1(P1 > 0))
It reports the following kind of errors,
Exiting fzero: aborting search for an interval containing a sign change
because complex function value encountered during search.
(Function value at -2.5228 is 3.3961e-18-1.174e-23i.)
Check function or try again with a different starting value.
P_cr =
0×1 empty double column vector
My question is that, how could i get positive real solutions. I shall be very thankful if somone can help me regarding this problem.
Risposta accettata
Più risposte (1)
Walter Roberson
il 2 Set 2020
1 voto
The only real root of your equation near 0 is 0. (There might be additional roots at large enough P.)
Near 0 the derivative is strictly negative for positive P.
Dana's explanation of why complex values are encountered is correct. In order to find the root at 0 fzero would have to bracket it from both sides but it cannot do that because of the complex values at negative P.
Categorie
Scopri di più su Scope Variables and Generate Names in Centro assistenza e File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!