将以下代码改为matlab的语言:syms a b; c=[a b]'; A=[79627.43,88131.12,95186.11,106762.43,112557.43,112350.00,113801.00, 104818.00,110600.00,120477.00]; B=cumsum(A); n=length(A); for i=1:(n-1) C(i)=(B(i)+B(i+1))/2; end D=A;D(1)=[]; D=D'; E=[-C;ones(1,n-1)]; c=inv(E*E')*E*D; c=c'; a=c(1);b=c(2); F=[];F(1)=A(1); for i=2:(n+5) F(i)=(A(1)-b/a)/exp(a*(i-1))+b/a; end G=[];G(1)=A(1); for i=2:(n+5) G(i)=F(i)-F(i-1); end t1=1:10; t2=1:15; G h=plot(t1,A,'o',t2,G,'-'); set(h,'LineWidth',3);
时间: 2023-08-22 16:08:55 浏览: 68
Matlab.rar_matlab pdf_site:www.pudn.com
syms a b;
c=[a b]';
A=[79627.43,88131.12,95186.11,106762.43,112557.43,112350.00,113801.00, 104818.00,110600.00,120477.00];
B=cumsum(A);
n=length(A);
for i=1:(n-1)
C(i)=(B(i)+B(i+1))/2;
end
D=A;
D(1)=[];
D=D';
E=[-C;ones(1,n-1)];
c=inv(E*E')*E*D;
c=c';
a=c(1);b=c(2);
F=[];
F(1)=A(1);
for i=2:(n+5)
F(i)=(A(1)-b/a)/exp(a*(i-1))+b/a;
end
G=[];
G(1)=A(1);
for i=2:(n+5)
G(i)=F(i)-F(i-1);
end
t1=1:10;
t2=1:15;
h=plot(t1,A,'o',t2,G,'-');
set(h,'LineWidth',3);
阅读全文