matlab GM(1,1)画出曲线图

function y=gm()
%??????a(????)?b(????)
syms a b;
c = [a b]';

%???? A
A = [41462, 28969, 32251, 47694, 32265, 27819, 33539, 36994];%VA
% A2=[70999	71282	85415	93747	101423	109150	115276	119349];%OH
% A3=[89981	86793	78577	72096	77318	75351	72376	68751];%PA
% A4=[29588	28285	27502	26820	27077	25811	26530	28870];%KY
% A5=[8668	9310	9429	9062	6926	5345	5405	3672];%WV
n=length(A)
% n1 = length(A1);
% n2 = length(A2);
% n3 = length(A3);
% n4 = length(A4);
% n5 = length(A5);
B=cumsum(A)
%????? A ??????? B
% B = cumsum(A1);
% B = cumsum(A2);
% B = cumsum(A3);
% B = cumsum(A4);
% B = cumsum(A5);

%??? B ???????
for i = 2:n
    C(i) = (B(i) + B(i - 1))/2; 
end
C(1) = [];

B = [-C;ones(1,n-1)];
Y = A; Y(1) = []; Y = Y';

c = inv(B*B')*B*Y;
c = c';
a = c(1); b = c(2);

F = []; F(1) = A(1);
for i = 2:(n+10)
    F(i) = (A(1)-b/a)/exp(a*(i-1))+ b/a;
end

%??? F ????,????????
G = []; G(1) = A(1);
for i = 2:(n+10)
    G(i) = F(i) - F(i-1); %?????????
end

disp('??????');
G

%????
H = G(1:8);
%??????
epsilon = A - H
%???????Q??
%????????
delta = abs(epsilon./A)
%??????Q
disp('????Q???')
Q = mean(delta)
%??????C??
disp('???C???')
C = std(epsilon, 1)/std(A, 1)

%????????P??
S1 = std(A, 1);
tmp = find(abs(epsilon - mean(epsilon))< 0.6745 * S1);
disp('?????P???')
P = length(tmp)/n


t1 = 2010:2017;
t2 = 2010:2027;

plot(t1, A,'ro'); hold on;
plot(t2, G, 'g-');

xlabel('Year');
ylabel('TDRS');
legend('VA','Predict');
title('????');
grid on;



评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

Laura_Wangzx

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值