Here x, y,teta are vectors. When I call the function fzero it shows this message:
fzero(@(t)shkruajek(x,y,1,3,teta,0.1,4,t),0)Exiting fzero: aborting search for an interval containing a sign change because NaN or Inf function value encountered during search.(Function value at -2.54232e+306 is NaN.)Check function or try again with a different starting value.NaN
can you help me to determine where is the problem here??
function [ek]=shkruajek(x,y,i,j,teta,speed,R,t)ek=sqrt(((x(i)+ speed*cos(teta(i)*t)) - (x(j) + speed*sin(cos(teta(j)*t))))^ 2+ ((y(i) + speed*sin(teta(i)*t)) - (y(j) + speed*sin(teta(j)*t))).^ 2)-R;end a=fzero(@(t)shkruajek(x,y,i,j,teta,speed,R,t),0);
Best Answer