matlab while循环如何保留循环过程的数值

2024-11-16 15:49:36
推荐回答(1个)
回答(1):

syms a b
T1=2;T2=3;
p=0;
k=1;
while p<=10
a=T1;
b=T2;
T1=2*a+b;
T2=a+2*b;
T11(k)=T1;
T22(k)=T2;
p33(k)=p;
p=p+1;k=k+1;
end
T1=T11';T2=T22';p=p33';
disp('p T1 T2')
[p T1 T2]