w=1;d=200;B=530;Ca=300;Cb=300;Fh=70;L=600;da=100;db=100;iteri=0;iterj=0;iterk=0;x=0;Tk=Ca-Cb;df=abs(Tk-Fh);while df>0.8 iterk=iterk+1; x=x+0.1; while abs(da)>0.0001 iteri=iteri+1; Ba=B+x; Dca=L-Ba-sqrt(d*(d+2*Ca))+Ca*acosh(1+(d/Ca)) Ja=-d/(sqrt(d*(d+2*Ca)))+acosh(1+(d/Ca))-d/(Ca*sqrt(((1+(d/Ca))^2)-1)) da=Dca/Ja; Ca=Ca-da; end while abs(db)>0.0001 iterj=iterj+1; Bb=B-x; Dcb=L-Bb-sqrt(d*(d+2*Cb))+Cb*acosh(1+(d/Cb)) Jb=-d/(sqrt(d*(d+2*Cb)))+acosh(1+(d/Cb))-d/(Cb*sqrt(((1+(d/Cb))^2)-1)) db=Dcb/Jb; Cb=Cb-db; end Tk=Ca-Cb; df=abs(Tk-Fh);end
MATLAB: Can anyone tell me why this code doesn’t stop running
while loop
Best Answer