I'm working on video, and have alot of computations in my processes. in one part i divide a number on another one, but I receive wrong result.
for example:
1.000000000000000e-03/ 1.000000000000000e-03+ 0
ans
=Inf
how can i handle this?
I use format short, but it doesn't help me.
please help

 채택된 답변

Arnaud Miege
Arnaud Miege 2011년 8월 2일

0 개 추천

You probably want (note the brackets):
m12 = deltaR12 / (min(deltaRF(ii, jj, tt), deltaRF_V(ii, jj, tt)) + epsilon);
Your code, as is divides deltaR12 by min(..,..), and then adds epsilon to the result of the division, which I suspect is not what you want.
HTH,
Arnaud

댓글 수: 4

Sean de Wolski
Sean de Wolski 2011년 8월 2일
Arnaud, how's the Do What I Mean Tbx coming along? We're expecting it for 2012a please :)
Arnaud Miege
Arnaud Miege 2011년 8월 2일
Still working on it...
shab shekan
shab shekan 2011년 8월 2일
Thank you Arnauld, I don't know how do i did this funny mistake,
you're right.
thank you so much.
Walter Roberson
Walter Roberson 2011년 8월 2일
Ever since Mr. D. Adams (RIP), suppliers have been demanding a share of intellectual property rights for everything that is powered by a Nice Hot Cup Of Tea.

댓글을 달려면 로그인하십시오.

추가 답변 (1개)

Walter Roberson
Walter Roberson 2011년 8월 1일

0 개 추천

Please copy the exact code that reproduces this on your system. It appears that the denominator on the division is becoming 0, which could perhaps happen due to the exact spacing you use.
Also, I suggest you try
format short g

댓글 수: 1

shab shekan
shab shekan 2011년 8월 2일
epsilon=.001;
c=0;
format short;
for tt=1 : nframes-1
for ii=1: height -1
for jj=1: width -1
M12 = M(ii*3-2:ii*3, jj*3-2:jj*3, tt) + M_V(ii*3-2:ii*3, jj*3-2:jj*3, tt);
deltaR12 = det(M12) / det(M12(1:2 , 1:2)) * norm(M12(1:2 , 1:2), 'fro');
if isnan(deltaR12)
deltaR12 =0.001;
end
m12 = deltaR12 / min(deltaRF(ii, jj, tt), deltaRF_V(ii, jj, tt)) + epsilon;
c = c+ m12;
end
end
end
c=1/c*N;
-----
denominator never can be zero, because of 'epsilon' is constant in denominator. My problem is in this line "m12 = deltaR12 / min(deltaRF(ii, jj, tt), deltaRF_V(ii, jj, tt)) + epsilon;"
and I used "format short g" before, and it doesn't usefull for my problem.
by the way, thank you so much walter.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Introduction to Installation and Licensing에 대해 자세히 알아보기

제품

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by