汉江安康站径流量的最值问题的研究最全代码(matlab)

汉江安康站径流量的最值问题的研究

摘要

在全球气候变化的大背景下,气候作为重要的环境因素,对区域经济发展有着至关重要的影响。研究陕南汉江安康站的径流量变化,对于确定陕西的经济发展战略以及制定发展规划意义重大。此项研究不仅有助于深入了解该地区水资源的动态变化规律,也为陕西经济的可持续发展提供了有力的科学依据。

针对问题一,通过对安康站统计的最大、最小径流量数据表进行深入分析,生成Excel图表,结合当地气候,人文因素分析最大,最小径流量之间的关系。

针对问题二,基于流量大小时间序列模型中的平稳性Daniel检验判断汉江安康站1943-1997年间的最大和最小径流量时间序列数据是否平稳,根据时间序列的特征和分析目给不稳定的序列做差分处理,根据差分后稳定的新时间序列计算出数据之间的自相关系数(ACF)和偏相关系数(PACF)建立合适的时间序列模型参数P,D,Q。随后基于计算出的参数P,D,Q拟合出合适的ARIMA预测模型

针对问题三,并从理论基础、实际拟合度等多个方面检验模型的合理性。利用该模型对1998-2002年汉江安康站的最大、最小径流量进行预报,与实际情况对比,以评估模型的准确性和适用性。

最后,我们对提出的模型进行全面的评价:本文的模型贴合实际,能合理解决提出的问题,具有实用性强,算法效率高等特点。

关键词:  时间序列  ARIMA模型   汉江安康站径流量  拟合

    1. 模型的推广

随着气候变化的影响日益显著,径流量数据也会受到气候变化的影响。可以将 ARIMA 模型与气候变化相关的参数相结合,研究气候变化对径流量最值的影响。例如,将气温、降水等气候参数作为外生变量引入 ARIMA 模型中,建立气候-径流量联合模型。通过这种方式,可以更好地理解气候变化对水资源的影响,为适应气候变化的水资源管理策略提供支持。

改进:结合参考文献《汉江上游径流演变趋势及影响因素分析》,进一步考虑河流下垫面变化的影响,从而得到更合理的模型。

参考文献

  1. 谢雨婧,韩惠丽.北师大版初中数学教材中数学建模的多维度分析[J].教学与管理,2023(09):73-76.
  2. 刘志梅.数学建模与高职数学教学的深度融合[J].佳木斯职业学院学报,2023,39(03):152-154.
  3. 许亚桃,吴立宝.基于Delphi-AHP数学建模教学评价指标体系的研究[J].内江师范学院学报,2023,38(02):113-119.DOI:10.13603/j.cnki.51-1621/z.2023.02.018.
  4. 杨本朝,石雅男,段乾恒,李光松,于刚.大学生数学建模竞赛开展全周期教学实践探究[J].大学教育,2023(04):44-46.
  5. 黄健,徐斌艳.国际视野下数学建模教与学研究的发展趋势——基于第14届国际数学教育大会的分析[J].数学教育学报,2023,32(01):93-98.
  6. 李桃英,殷峻暹,张丽丽,赵红莉.汉江上游径流演变趋势及影响因素分析——人民长江,2011(09):19-22

附录

附录1  汉江安康站1943~1997年径流量数据

年份

最大泾

流量

最小泾

流量

年份

最大泾

流量

最小泾

流量

年份

最大泾

流量

最小泾

流量

1943

6000

71.3

1962

10800

83.3

1981

15400

50.8

1944

3890

83.3

1963

16900

76.8

1982

15000

63.1

1945

9310

44

1964

13700

120

1983

31000

62.5

1946

12800

10.5

1965

20400

90

1984

19200

181.4

1947

5680

97

1966

3550

72.5

1985

11300

69.9

1948

16900

97

1967

11800

74.6

1986

6760

54.6

1949

1400

100

1968

19700

92

1987

17500

36

1950

8720

116

1969

6640

75

1988

4790

36.2

1951

18000

67.6

1970

7630

94.5

1989

1030

2.5

1952

15300

89.7

1971

7300

95.4

1990

8040

6.09

1953

9570

90

1972

7600

44.9

1991

4800

5.76

1954

8110

106

1973

12500

51.8

1992

7560

4.51

1955

19900

51.6

1974

23400

56.1

1993

7960

8.5

1956

15100

86

1975

15300

55.3

1994

5110

9.4

1957

11700

84

1976

8130

77.5

1995

5500

5.93

1958

16600

60.5

1977

9120

43.2

1996

5420

6.3

1959

4190

108

1978

16000

48

1997

2450

2.8

1960

18500

63.1

1979

16000

48.8

1961

8390

95.9

1980

14700

50.8

附录2:最大径流量和最小径流量ACF

滞后

最大径流量ACF

最小径流量ACF

1

1

1

2

-0.461644621

-0.431997215

3

-0.076562924

-0.001300939

4

0.048993532

0.033839538

5

-0.05537827

-0.101976465

6

0.19174865

0.043677459

7

-0.148790178

-0.001926076

8

0.064334731

-0.022908986

9

-0.155528813

-0.059050136

10

0.090305218

0.075584887

11

0.238207873

-0.010376521

12

-0.300138547

-0.062764432

13

0.110937392

0.095501523

14

0.028254686

-0.152734661

15

-0.110698221

0.170625312

16

0.068603154

-0.045191956

17

-0.027076833

-0.046867414

18

0.025862735

0.146989697

19

-0.078320054

-0.126657418

20

0.112638497

-0.090124601

21

0.050636359

0.192947648

附录3:最大径流量和最小径流量PACF

滞后

最大径偏相关流量PACF

最小径偏相关流量PACF

1

1

1

2

-0.431997215

-0.432024138

3

-0.001300939

-0.227409141

4

0.033839538

-0.086566838

5

-0.101976465

-0.149012996

6

0.043677459

-0.092450083

7

-0.001926076

-0.052934626

8

-0.022908986

-0.065184671

9

-0.059050136

-0.144641284

10

0.075584887

-0.050150714

11

-0.010376521

-0.021005721

12

-0.062764432

-0.113488999

13

0.095501523

-0.002346547

14

-0.152734661

-0.391056797

15

0.170625312

-0.016475592

16

-0.045191956

-0.000457648

17

-0.046867414

-0.129368191

18

0.146989697

0.184616484

19

-0.126657418

0.135395526

20

-0.090124601

-0.332213887

21

0.192947648

0.255636711

附录5

基于时间序列的AIRIMA模型求解代码

% 建立最大和最小泾流量的ARIMA模型

% 清空工作区和命令窗口

clear; clc;

% 生成模拟泾流量数据

years = (1943:1997)'; % 年份

max_flow = [6000 3890 9310 12800 5680 16900 1400 8720 18000 15300 9570 8110 19900 15100 11700 16600 4190 18500 8390 10800 16900 13700 20400 3550 11800 19700 6640 7630 7300 7600 12500 23400 15300 8130 9120 16000 16000 14700 15400 15000 31000 19200 11300 6760 17500 4790 10300 8040 4800 7560 7960 5110 5500 5420 2450

]; % 模拟最大泾流量

min_flow = [71.3 83.3 44 10.5 97 97 100 116 67.6 89.7 90 106 51.6 86 84 60.5 108 63.1 95.9 83.3 76.8 120 90 72.5 74.6 92 75 94.5 95.4 44.9 51.8 56.1 55.3 77.5 43.2 48 48.8 50.8 50.8 63.1 62.5 181.4 69.9 54.6 36 36.2 2.5 6.09 5.76 4.51 8.5 9.4 5.93 6.3 2.8

]; % 模拟最小泾流量

% 绘制最大和最小泾流量数据

figure;

subplot(2, 1, 1);

plot(years, max_flow, '-o', 'LineWidth', 1.5); % 绘制最大泾流量

title('最大泾流量');

xlabel('年份');

ylabel('流量 (单位)');

grid on;

subplot(2, 1, 2);

plot(years, min_flow, '-o', 'LineWidth', 1.5); % 绘制最小泾流量

title('最小泾流量');

xlabel('年份');

ylabel('流量 (单位)');

grid on;

% 平稳性检验:Daniel检验(简化版) - 检验线性趋势

% 通过线性回归来代替 Daniel 检验的原理

coeffs_max = polyfit(years, max_flow, 1); % 最大泾流量的线性回归

coeffs_min = polyfit(years, min_flow, 1); % 最小泾流量的线性回归

fprintf('最大泾流量的线性趋势检验结果:\n');

fprintf('斜率 (趋势): %.4f\n', coeffs_max(1));

fprintf('截距: %.4f\n\n', coeffs_max(2));

fprintf('最小泾流量的线性趋势检验结果:\n');

fprintf('斜率 (趋势): %.4f\n', coeffs_min(1));

fprintf('截距: %.4f\n', coeffs_min(2));

% Spearman 秩相关系数

rho_max = corr(years, max_flow', 'Type', 'Spearman'); % 最大泾流量的Spearman系数

rho_min = corr(years, min_flow', 'Type', 'Spearman'); % 最小泾流量的Spearman系数

fprintf('\n最大泾流量的Spearman秩相关系数: %.4f\n', rho_max);

fprintf('最小泾流量的Spearman秩相关系数: %.4f\n\n', rho_min);

% 检测平稳性:差分

diff_max_flow = diff(max_flow); % 最大泾流量差分

diff_min_flow = diff(min_flow); % 最小泾流量差分

% 绘制差分后的时间序列

figure;

subplot(2, 1, 1);

plot(years(2:end), diff_max_flow, '-o', 'LineWidth', 1.5);

title('最大泾流量差分');

xlabel('年份');

ylabel('差分流量 (单位)');

grid on;

subplot(2, 1, 2);

plot(years(2:end), diff_min_flow, '-o', 'LineWidth', 1.5);

title('最小泾流量差分');

xlabel('年份');

ylabel('差分流量 (单位)');

grid on;

diff_max_flow1 = diff(diff_max_flow); % 第二次最大泾流量差分

% 绘制差分后的时间序列

figure;

plot(years(2:end), diff_max_flow, '-o', 'LineWidth', 1.5);

title('最大泾流量第二次差分');

xlabel('年份');

ylabel('差分流量 (单位)');

grid on;

% 自相关函数(ACF)和偏自相关函数(PACF)

figure;

subplot(2, 1, 1);

autocorr(diff_max_flow); % 计算并绘制最大泾流量的自相关函数

title('最大泾流量自相关函数');

subplot(2, 1, 2);

parcorr(diff_max_flow); % 计算并绘制最大泾流量的偏自相关函数

title('最大泾流量偏自相关函数');

figure;

subplot(2, 1, 1);

autocorr(diff_min_flow); % 计算并绘制最小泾流量的自相关函数

title('最小泾流量自相关函数');

subplot(2, 1, 2);

parcorr(diff_min_flow); % 计算并绘制最小泾流量的偏自相关函数

title('最小泾流量偏自相关函数');

AFC1 = autocorr(diff_max_flow);

AFC2 = autocorr(diff_min_flow) ;

PACF1 = parcorr(diff_max_flow);

PACF2 = parcorr(diff_min_flow);

% 拆分数据为训练集和测试集

train_years = years(1:end-5); % 训练集年份(前50年)

test_years = years(end-4:end); % 测试集年份(后5年)

train_max1 = max_flow(1:end-5); % 训练集最大泾流量

train_max = train_max1'; %转置为列向量

test_max = max_flow(end-4:end); % 测试集最大泾流量

train_min1 = min_flow(1:end-5); % 训练集最小泾流量

train_min = train_min1';

test_min = min_flow(end-4:end); % 测试集最小泾流量

% 得到p=5,d=2,q= 1

% 拟合ARIMA模型

model_max = arima(5, 2, 1); % 定义ARIMA模型

fit_model_max = estimate(model_max, train_max); % 拟合模型

% 得到p=10,d=1,q= 0

model_min = arima(10, 1, 0); % 定义ARIMA模型

fit_model_min = estimate(model_min, train_min); % 拟合模型

% 进行预测

num_forecast = length(test_years); % 预测数量

[YF_max, ~] = forecast(fit_model_max, num_forecast, 'Y0', train_max); % 最大泾流量预测后五年

[YF_min, ~] = forecast(fit_model_min, num_forecast, 'Y0', train_min); % 最小泾流量预测后五年

% 绘制预测结果

figure;

hold on;

plot(years(1:end-5), train_max, 'b', 'LineWidth', 1.5); % 绘制训练集最大泾流量

plot(test_years, test_max, 'g', 'LineWidth', 1.5); % 绘制测试集最大泾流量

plot(test_years, YF_max, 'r--', 'LineWidth', 1.5); % 绘制预测最大泾流量

title('最大泾流量预测');

xlabel('年份');

ylabel('流量 (单位)');

legend('训练数据', '测试数据', '预测数据', 'Location', 'Best');

grid on;

figure;

hold on;

plot(years(1:end-5), train_min, 'b', 'LineWidth', 1.5); % 绘制训练集最小泾流量

plot(test_years, test_min, 'g', 'LineWidth', 1.5); % 绘制测试集最小泾流量

plot(test_years, YF_min, 'r--', 'LineWidth', 1.5); % 绘制预测最小泾流量

title('最小泾流量预测');

xlabel('年份');

ylabel('流量 (单位)');

legend('训练数据', '测试数据', '预测数据', 'Location', 'Best');

grid on;

% 绘制训练集的预测结果与真实值的比较

figure;

hold on;

plot(years(1:end-5), train_max, 'b', 'LineWidth', 1.5); % 绘制训练集最大泾流量

plot(test_years, test_max, 'g', 'LineWidth', 1.5); % 绘制测试集最大泾流量

plot(test_years, YF_max, 'r--', 'LineWidth', 1.5); % 绘制预测最大泾流量

title('最大泾流量预测与真实值比较');

xlabel('年份');

ylabel('流量 (单位)');

legend('训练数据', '测试数据', '预测数据', 'Location', 'Best');

grid on;

% 计算绝对误差

absolute_error_max = abs(YF_max - test_max);

fprintf('最大泾流量的绝对误差:\n');

disp(absolute_error_max); % 输出绝对误差

% 绘制最小泾流量的预测结果与真实值的比较

figure;

hold on;

plot(years(1:end-5), train_min, 'b', 'LineWidth', 1.5); % 绘制训练集最小泾流量

plot(test_years, test_min, 'g', 'LineWidth', 1.5); % 绘制测试集最小泾流量

plot(test_years, YF_min, 'r--', 'LineWidth', 1.5); % 绘制预测最小泾流量

title('最小泾流量预测与真实值比较');

xlabel('年份');

ylabel('流量 (单位)');

legend('训练数据', '测试数据', '预测数据', 'Location', 'Best');

grid on;

% 计算绝对误差

absolute_error_min = abs(YF_min - test_min);

fprintf('最小泾流量的绝对误差:\n');

disp(absolute_error_min); % 输出绝对误差

% 绘制绝对误差的条形图

figure;

bar([absolute_error_max', absolute_error_min']);

xlabel('年份');

ylabel('绝对误差 (单位)');

title('最大泾流量和最小泾流量的绝对误差比较');

legend('最大泾流量', '最小泾流量', 'Location', 'Best');

% grid on;

% 将预测值与真实值结合

full_years = years; % 包含所有年份

predicted_max_flow = YF_max; % 训练集与预测值结合

predicted_min_flow = YF_min; % 训练集与预测值结合

% 计算绝对误差YF_max1YF_min1

absolute_error_max = abs(predicted_max_flow - max_flow(end-4:end)');

absolute_error_min = abs(predicted_min_flow - min_flow(end-4:end)');

% 输出绝对误差

fprintf('1992-1997年最大泾流量的绝对误差:\n');

disp(absolute_error_max);

fprintf('1992-1997年最小泾流量的绝对误差:\n');

disp(absolute_error_min);

% 绘制预测结果与真实值的比较

figure;

hold on;

plot(test_years, test_max, 'g', 'LineWidth', 1.5, 'DisplayName', '真实最大泾流量');

plot(test_years, predicted_max_flow, 'r--', 'LineWidth', 1.5, 'DisplayName', '预测最大泾流量');

title('1992-1997年最大泾流量预测与真实值比较');

xlabel('年份');

ylabel('流量 (单位)');

legend('Location', 'Best');

grid on;

figure;

hold on;

plot(test_years, test_min, 'g', 'LineWidth', 1.5, 'DisplayName', '真实最小泾流量');

plot(test_years, predicted_min_flow, 'r--', 'LineWidth', 1.5, 'DisplayName', '预测最小泾流量');

title('1992-1997年最小泾流量预测与真实值比较');

xlabel('年份');

ylabel('流量 (单位)');

legend('Location', 'Best');

grid on;

% 计算均方根误差(RMSE)以评估预测性能

rmse_max = sqrt(mean((YF_max - test_max).^2)); % 计算最大泾流量的RMSE

rmse_min = sqrt(mean((YF_min - test_min).^2)); % 计算最小泾流量的RMSE

fprintf('最大泾流量的均方根误差 (RMSE): %.4f\n', rmse_max) % 输出RMSE

fprintf('最小泾流量的均方根误差 (RMSE): %.4f\n', rmse_min)% 输出RMSE

% 计算最大径和最小径之间的相关系数

correlation_coefficient = corr(max_flow', min_flow'); % 计算相关系数

fprintf('最大径和最小径之间的相关系数: %.4f\n', correlation_coefficient); % 输出相关系数

% 检查最大泾流量模型的残差

residuals_max = infer(fit_model_max, train_max);

figure;

subplot(2, 1, 1);

plot(residuals_max);

title('最大泾流量模型残差');

xlabel('时间');

ylabel('残差');

grid on;

subplot(2, 1, 2);

autocorr(residuals_max); % 残差的自相关函数

title('最大泾流量残差自相关函数');

% Ljung-Box检验

[h_max, pValue_max, QStat_max, criticalValue_max] = lbqtest(residuals_max, 'Lags', 10);

fprintf('最大泾流量模型残差的Ljung-Box检验结果:\n');

fprintf('检验统计量: %.4f\n', QStat_max);

fprintf('p值: %.4f\n', pValue_max);

if h_max == 0

fprintf('残差为白噪声 (未拒绝原假设)\n');

else

fprintf('残差不是白噪声 (拒绝原假设)\n');

end

% 检查最小泾流量的残差

residuals_min = infer(fit_model_min, train_min);

figure;

subplot(2, 1, 1);

plot(residuals_min);

title('最小泾流量模型残差');

xlabel('时间');

ylabel('残差');

grid on;

subplot(2, 1, 2);

autocorr(residuals_min); % 残差的自相关函数

title('最小泾流量残差自相关函数');

% Ljung-Box检验

[h_min, pValue_min, QStat_min, criticalValue_min] = lbqtest(residuals_min, 'Lags', 10);

fprintf('最小泾流量模型残差的Ljung-Box检验结果:\n');

fprintf('检验统计量: %.4f\n', QStat_min);

fprintf('p值: %.4f\n', pValue_min);

if h_min == 0

fprintf('残差为白噪声 (未拒绝原假设)\n');

else

fprintf('残差不是白噪声 (拒绝原假设)\n');

end

% 进行未来五年的预测

num_forecast = 5; % 预测未来五年的数量

% 最大径流量的预测

[YF_max1, ~] = forecast(fit_model_max, num_forecast, 'Y0', max_flow') % 最大径流量预测

% 最小径流量的预测

[YF_min1, ~] = forecast(fit_model_min, num_forecast, 'Y0', min_flow'); % 最小径流量预测

% 生成未来五年的年份

future_years = (years(end) + 1):(years(end) + num_forecast); % 未来五年的年份

% 绘制最大径流量预测结果

figure;

hold on;

plot(years(1:end-5), train_max, 'b', 'LineWidth', 1.5); % 绘制训练集最大径流量

plot(test_years, test_max, 'g', 'LineWidth', 1.5); % 绘制测试集最大径流量

plot(future_years, YF_max, 'r--', 'LineWidth', 1.5); % 绘制预测最大径流量

title('最大径流量预测');

xlabel('年份');

ylabel('流量 (单位)');

legend('训练数据', '测试数据', '预测数据', 'Location', 'Best');

grid on;

% 绘制最小径流量预测结果

figure;

hold on;

plot(years(1:end-5), train_min, 'b', 'LineWidth', 1.5); % 绘制训练集最小径流量

plot(test_years, test_min, 'g', 'LineWidth', 1.5); % 绘制测试集最小径流量

plot(future_years, YF_min, 'r--', 'LineWidth', 1.5); % 绘制预测最小径流量

title('最小径流量预测');

xlabel('年份');

ylabel('流量 (单位)');

legend('训练数据', '测试数据', '预测数据', 'Location', 'Best');

grid on;

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值