matlab灰色预测(例题及代码)
文章目录 参考例题 灰色预测模型GM(1,1) 参考例题 1、题目: 2、程序: clear syms a b ; c = [ a b ] ' ; A = [ 89677 , 99215 , 109655 , 120333 , 135823 , 159878 , 182321 , 209407 , 246619 , 300670 ] ; 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 + 10 ) F ( i ) = ( A ( 1 ) - b / a ) / exp ( a * ( i - 1 ) ) + b / a ; end G = [ ] ; G ( 1 ) = A ( 1 ) ;