急求答案
为什么程序在while条件不满足的时候退不出循环呢,请各位帮忙看看,谢谢了a(1)=3.5;
e(1)=3;
a(2)=2.5;
e(2)=3.01;
a(3)=2;
e(3)=3.02;
p(1)=2.4301e-005;
p(2)=4.7365e-004;
p(3)= 0.0014;
cp(1)=4.4935e-004;
cp(2)=9.2635e-004;
ca(1)=-0.5;
ca(2)=-0.5;
ce(1)=0.01;
ce(2)=0.02;
w=1;
n=1;
c(1)=5.5300e-005;
d(1)= 0.0477;
t1=c(n)
t2=d(n)
t3=p(n)
while t3<0.97%sqrt(t1.^2+t2.^2)>=0.00000001%循环控制条件
c(n)=(-cp(n)*ce(n+1)+ce(n)*cp(n+1))/(ca(n+1)*ce(n)-ca(n)*ce(n+1));
d(n)=-(cp(n+1)*ca(n)-ca(n+1)*cp(n))/(ca(n+1)*ce(n)-ca(n)*ce(n+1));
cr=sqrt(ca(n).^2+ce(n).^2);
q=sqrt(c(n).^2+d(n).^2);%q为cos中分母的公共部分
cosm=c(n)/q;
cosn=d(n)/q;
ca(n+2)=cr*cosm;
ce(n+2)=cr*cosn;
a(n+3)=a(n+2)+ca(n+2);
e(n+3)=e(n+2)+ce(n+2);
f1=a(n+3);
p(n+3)=exp(-0.5*(a(n+3).^2+e(n+3).^2));
g1=p(n+3);
cp(n+2)=p(n+3)-p(n+2)
n=n+1;
if n>20,break,end
end
disp(n)
disp(p)