Complex number output vector instead of real output
Afficher commentaires plus anciens
Hey all,
I am solving for three equations using given input vector. My input vector is of real numbers. But the output vector is of complex numbers whose complex coefficient is zero. I am unable to understand why Matlab is giving complex output for certain elements even complex term is zero. The code I am analyzing is as follows:
dr=0.055:0.00001:0.063;
for i=1:1:length(dr)
pd=0.015;Fr=8900;Z=9;Kn=3.735e5;
phi1=acos(pd/(2*dr(i)));
epsi=0.5*(1-pd/(2*dr(i)));
f=@(theta)(1/(2*pi)*(1-(0.5/epsi)*(1-cos(theta))).^(1.5).*cos(theta));
Jr(i)=quad(f,-phi1,phi1);
fl(i)=Fr-(Z*Kn*(dr(i)-0.5*pd)^(1.5)*real(Jr(i)));
end;
If we see at the output certain elements of Jr vector are complex. Can somebody tell me why MATLAB is giving answer for certain elements in complex format even if there complex term is zero ? Thanks in advance,
Nikhil
Réponse acceptée
Plus de réponses (0)
Catégories
En savoir plus sur Mathematics dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!