注:MATLAB版本--2016a,做圖分析部分見《MATLAB之折線圖、柱狀圖、餅圖以及經常使用繪圖技巧》html
%第一題:創建總成本分析模型/年:按現狀分析 % 總成本=直接成本 +經濟技術成本 + 社會成本 function dataPro = Total_Cost_Analysis(year) %垃圾每一年預測表:2017-2030 table = [ 6.4450e+06 6.8317e+06 7.2416e+06 7.6761e+06 7.9832e+06 8.3025e+06 8.6346e+06 8.9800e+06 9.3392e+06 9.6193e+06 9.9079e+06 1.0205e+07 1.0511e+07 1.0827e+07]; %垃圾總量每一年數值(2017-2030) rubbish_quantity = table(year-2016); %將時間分期處理:2017-2020,2021-2025,2026-2030 switch year case { 2017,2018,2019,2020} %近期 rubbish_num_burn=215*10^4; rubbish_num_landfill = rubbish_quantity-rubbish_num_burn; class_cost = 0; handle_cost = rubbish_num_landfill*60+ rubbish_num_burn*100; transport_cost = 0.5*rubbish_num_landfill*60+0.5*rubbish_num_landfill*70+... 0.5*rubbish_num_burn*60+0.5*rubbish_num_burn*70 ; social_cost =132*rubbish_quantity; technology_cost=1300*10^4; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 100*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity/102.49*10^8 ; case {2021,2022,2023,2024,2025} %中期 rubbish_num_burn =215*10^4; rubbish_num_landfill = rubbish_quantity-rubbish_num_burn; class_cost = 0; handle_cost = rubbish_num_landfill*60+ rubbish_num_burn*150; transport_cost = rubbish_quantity*100; social_cost =2*132*rubbish_quantity; technology_cost=1300*10^4; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 50*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity*(1/104.15+1/100.1+1/317.46)*10^8 +rubbish_quantity/1.54*10^4; %不一樣時間 定值 case {2026,2027,2028,2029,2030} %遠期 rubbish_num_burn =215*10^4; rubbish_num_landfill = rubbish_quantity-rubbish_num_burn; class_cost = 0; handle_cost = rubbish_num_landfill*60+ rubbish_num_burn*180; transport_cost = rubbish_quantity*100; social_cost =2*132*rubbish_quantity; technology_cost=1300*10^4; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 0*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity*(1/104.15+1/50.05+1/222.22)*10^8 +rubbish_quantity/1.54*10^4 ; %不一樣時間 定值 otherwise msgbox('親,請從新輸入年份:'); end %設施投資: equipment_cost = 1.56*10^8; %輸出,分析:dataPro爲數據集合 profit =profit *0.15; direct_cost = class_cost + transport_cost + equipment_cost + handle_cost; total_cost = direct_cost+technology_cost +social_cost+subsidy-profit ; %dataPro(11): 分類,收運,設施,處理,技術,社會,補貼,收益,直接,總,均 dataPro = [ class_cost,transport_cost,equipment_cost,handle_cost, ... technology_cost,social_cost,subsidy,profit,direct_cost,total_cost,total_cost/rubbish_quantity]; end
%模式一:總成本=直接成本 +經濟技術成本 + 社會成本 function dataPro = Total_Cost_Analysis_model1(year) %垃圾每一年預測表:2017-2030 table = [ 6.4450e+06 6.8317e+06 7.2416e+06 7.6761e+06 7.9832e+06 8.3025e+06 8.6346e+06 8.9800e+06 9.3392e+06 9.6193e+06 9.9079e+06 1.0205e+07 1.0511e+07 1.0827e+07]; %垃圾總量每一年數值(2017-2030) rubbish_quantity = table(year-2016); %將時間分期處理:2014-2020,2021-2025,2026-2030 switch year case {2016,2017,2018,2019,2020} rubbish_num_burn=215*10^4; %近期 rubbish_num_landfill = rubbish_quantity-rubbish_num_burn; transport_cost = 0.5*rubbish_quantity*60+0.5*rubbish_quantity*70; handle_cost = rubbish_num_landfill*60+rubbish_num_burn*100; social_cost = 132*rubbish_quantity; technology_cost=1300*10^4; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 100*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity/102.49*10^8 ; %不一樣時間 定值 case {2021,2022,2023,2024,2025} transport_cost = rubbish_quantity*100; handle_cost = rubbish_quantity*150; social_cost =8*132*rubbish_quantity; technology_cost=1300*10^4; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 50*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))* rubbish_quantity*(1/52.1+1/100.1 )*10^8 +rubbish_quantity/0.77*10^4; case {2026,2027,2028,2029,2030} transport_cost = rubbish_quantity*100; handle_cost = rubbish_quantity*180; social_cost =8*132*rubbish_quantity; technology_cost=1300*10^4; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 0*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity*(1/52.07+1/50.05 )*10^8 +rubbish_quantity/0.77*10^4; otherwise msgbox('親,請從新輸入年份:'); end %分類費用 class_cost = 0; %設施投資: equipment_cost = 0 ; %輸出,分析 profit =profit *0.15; direct_cost = class_cost + transport_cost + equipment_cost + handle_cost; total_cost = direct_cost+technology_cost +social_cost+subsidy-profit ; %dataPro(11): 分類,收運,設施,處理,技術,社會,補貼,收益,直接,總,均 dataPro = [ class_cost,transport_cost,equipment_cost,handle_cost, ... technology_cost,social_cost,subsidy,profit,direct_cost,total_cost,total_cost/rubbish_quantity]; end
%模式二:源頭分類收集+溼垃圾生物處理+幹垃圾焚燒+中心城區幹垃圾轉運 function dataPro = Total_Cost_Analysis_model2(year) %垃圾每一年預測表:2017-2030 table = [ 6.4450e+06 6.8317e+06 7.2416e+06 7.6761e+06 7.9832e+06 8.3025e+06 8.6346e+06 8.9800e+06 9.3392e+06 9.6193e+06 9.9079e+06 1.0205e+07 1.0511e+07 1.0827e+07]; %垃圾總量每一年數值(2017-2030) rubbish_quantity = table(year-2016); switch year case {2016,2017,2018,2019,2020} rubbish_num_burn=215*10^4; %近期 rubbish_num_landfill = rubbish_quantity-rubbish_num_burn; class_cost = 0; transport_cost = 0.5*rubbish_quantity*60+0.5*rubbish_quantity*70; handle_cost = rubbish_num_landfill*60+rubbish_num_burn*100; social_cost =132*rubbish_quantity; technology_cost=1300*10^4+10^8; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 100*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity/102.49*10^8 ; %不一樣時間 定值 case {2021,2022,2023,2024,2025} class_cost = 10.6*10^8; transport_cost = 0.4*rubbish_quantity*60+0.6*rubbish_quantity*100; handle_cost = rubbish_quantity*150; social_cost =1.2*132*rubbish_quantity; % (year-2017) technology_cost=1300*10^4+0.7*10^8; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 50*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity*(1/72.31+1/396.83+1/100.1)*10^8 +rubbish_quantity/1.28*10^4 ; %不一樣時間 定值 case {2026,2027,2028,2029,2030} class_cost = 10.6*10^8; transport_cost = 0.5*rubbish_quantity*60+0.5*rubbish_quantity*100; handle_cost = 0.5*rubbish_quantity*180+ 0.5*rubbish_quantity*200; social_cost =1.2*132*rubbish_quantity; % (year-2017) technology_cost=1300*10^4+0.4*10^8; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 0*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))* rubbish_quantity*(1/77.98+1/277.78+1/50.05)*10^8 +rubbish_quantity/1.28*10^4; otherwise msgbox('親,請從新輸入年份:'); end %設施投資: equipment_cost = 0; %輸出,分析 profit =profit *0.15; direct_cost = class_cost + transport_cost + equipment_cost + handle_cost; total_cost = direct_cost+technology_cost +social_cost+subsidy-profit ; %dataPro(11): 分類,收運,設施,處理,技術,社會,補貼,收益,直接,總,均 dataPro = [ class_cost,transport_cost,equipment_cost,handle_cost, ... technology_cost,social_cost,subsidy,profit,direct_cost,total_cost,total_cost/rubbish_quantity]; end
%模式三:混合收集+末端分類+溼垃圾生物處理+幹垃圾焚燒+中心城區幹垃圾轉運 function dataPro = Total_Cost_Analysis_model3(year) %垃圾每一年預測表:2017-2030 table = [ 6.4450e+06 6.8317e+06 7.2416e+06 7.6761e+06 7.9832e+06 8.3025e+06 8.6346e+06 8.9800e+06 9.3392e+06 9.6193e+06 9.9079e+06 1.0205e+07 1.0511e+07 1.0827e+07]; %垃圾總量每一年數值(2017-2030) rubbish_quantity = table(year-2016); switch year case {2016,2017,2018,2019,2020} rubbish_num_burn=215*10^4; %近期 rubbish_num_landfill = rubbish_quantity-rubbish_num_burn; transport_cost = 0.5*rubbish_quantity *60+0.5*rubbish_quantity *70 ; handle_cost = rubbish_num_landfill*60+rubbish_num_burn*100; social_cost =132*rubbish_quantity; technology_cost=1300*10^4+10^8; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 100*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity/102.49*10^8 ; %不一樣時間 定值 case {2021,2022,2023,2024,2025} handle_cost = 0.5*rubbish_quantity*150+ 0.5*rubbish_quantity*200; transport_cost = 0.4*rubbish_quantity*60+0.6*rubbish_quantity*100; social_cost =132*rubbish_quantity; technology_cost=1300*10^4+0.7*10^8; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 50*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity*(1/86.87+1/317.46+1/100.1)*10^8 +rubbish_quantity/1.54*10^4; %不一樣時間 定值 case {2026,2027,2028,2029,2030} handle_cost = 0.5*rubbish_quantity*180+ 0.5*rubbish_quantity*200; transport_cost = 0.4*rubbish_quantity*60+0.6*rubbish_quantity*100; social_cost =132*rubbish_quantity; technology_cost=1300*10^4+0.4*10^8; % 溼處理分期:10^8,0.7*10^8,0.4*10^8 subsidy = 0*rubbish_quantity; %前期 100,中期50,後期取消,成本計算取負 profit = (10^(-4))*rubbish_quantity*(1/86.80+1/222.22+1/50.05)*10^8 +rubbish_quantity/1.54*10^4; %不一樣時間 定值 otherwise msgbox('親,請從新輸入年份:'); end %設施投資: equipment_cost = 0; %分類 class_cost = 0; %輸出,分析 profit =profit *0.15; direct_cost = class_cost + transport_cost + equipment_cost + handle_cost; total_cost = direct_cost+technology_cost +social_cost+subsidy-profit ; %dataPro(11): 分類,收運,設施,處理,技術,社會,補貼,收益,直接,總,均 dataPro = [ class_cost,transport_cost,equipment_cost,handle_cost, ... technology_cost,social_cost,subsidy,profit,direct_cost,total_cost,total_cost/rubbish_quantity]; end
%垃圾總量預測 rubbish_table = zeros(1,14); rubbish_table(1,1) = 541.14*10^4; %2014年垃圾產量541.14萬噸 for year = 2015:2020 rubbish_table(1,year-2013) = rubbish_table (1,year-2014)*(1+0.06); end for year = 2021:2025 rubbish_table(1,year-2013) = rubbish_table (1,year-2014)*(1+0.04); end for year = 2026:2030 rubbish_table(1,year-2013) = rubbish_table (1,year-2014)*(1+0.03); end
% 總成本=直接成本 +經濟技術成本 + 社會成本 %數據收集data_model(從2017-2030年:現狀,模式一,模式二,模式三) clear;close;clc; data_model0 = zeros(14, 11); data_model1 = zeros(14, 11); data_model2 = zeros(14, 11); data_model3 = zeros(14, 11); for year = 2017 : 2030 dataPro0 = Total_Cost_Analysis(year ); %現狀 dataPro1 = Total_Cost_Analysis_model1(year ); dataPro2 = Total_Cost_Analysis_model2(year ); dataPro3 = Total_Cost_Analysis_model3(year ); for i = 1:11 data_model0(year-2016,i) = dataPro0(i); data_model1(year-2016,i) = dataPro1(i); data_model2(year-2016,i) = dataPro2(i); data_model3(year-2016,i) = dataPro3(i); end end
%優選模式計算:分類0.3,設施0.5,收運1.5,處理1,技術1,社會1.7,收益-2 %原理較複雜,優選模式以遠期成本最優,而且設定不一樣成本的比重,所得結果爲每噸垃圾的成本 % table = [9.6193e+06 9.9079e+06 1.0205e+07 1.0511e+07 1.0827e+07]; %垃圾總量每一年數值(遠期2025-2030) rubbish_quantity = sum(table,2); x=0.3*sum(data_model0(10:14,1))+0.5*sum(data_model0(10:14,3))+1.5*sum(data_model0(10:14,2))+... 1*sum(data_model0(10:14,4))+1*sum(data_model0(10:14,5))+1.7*sum(data_model0(10:14,6))+... 2*sum(data_model0(10:14,8)); table0 =x/rubbish_quantity %現狀模式 /rubbish_quantity x=0.3*sum(data_model1(10:14,1))+0.5*sum(data_model1(10:14,3))+1.5*sum(data_model1(10:14,2))+... 1*sum(data_model1(10:14,4))+1*sum(data_model1(10:14,5))+1.7*sum(data_model1(10:14,6))+... 2*sum(data_model1(10:14,8)); table1 = x/rubbish_quantity %模式一 x=0.3*sum(data_model2(10:14,1))+0.5*sum(data_model2(10:14,3))+1.5*sum(data_model2(10:14,2))+... 1*sum(data_model2(10:14,4))+1*sum(data_model2(10:14,5))+1.7*sum(data_model2(10:14,6))+... 2*sum(data_model2(10:14,8)); table2 = x/rubbish_quantity %模式二 x=0.3*sum(data_model3(10:14,1))+0.5*sum(data_model3(10:14,3))+1.5*sum(data_model3(10:14,2))+... 1*sum(data_model3(10:14,4))+1*sum(data_model3(10:14,5))+1.7*sum(data_model3(10:14,6))+... 2*sum(data_model3(10:14,8)); table3 = x/rubbish_quantity %模式三