Professional Documents
Culture Documents
clc;
for n = 0:999999999
f = @(R) (R - r)*sin(s/(2*(R + r)))-(k/2);
R3 = (f(R1)*R2 - f(R2)*R1)/(f(R1) - f(R2));
depo = [depo R3];
if abs(depo(n+1)-R3)<tolerance
break
endif
if f(R1)*f(R3) < 0
R2 = R3;
continue
elseif f(R1)*f(R3) > 0
R1 = R3;
continue
elseif f(R1)*f(R3) == 0
break
endif
endfor