资源描述:
《数学建模作业4.doc》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、数学建模作业-----第五章①非线性最小二乘问题(1)最小二乘方法无约束问题为:minz=i=1n(a+becεi-i)2编写lingo程序:sets:quantity/1..15/:x,y;endsetsdata:x=2,5,7,10,14,19,26,31,34,38,45,52,53,60,65;y=54,50,45,37,35,25,20,16,18,13,8,11,8,4,6;enddatamin=@sum(quantity:(a+b*@exp(x*c)-y)^2);@free(a);@free(b);@free(c);结果:Localoptima
2、lsolutionfound.Objectivevalue:44.78049Extendedsolversteps:5Totalsolveriterations:68VariableValueReducedCostA2.4301770.000000B57.332090.000000C-0.4460383E-010.000000(2)最小一乘法无约束问题为:min(a,b)z=i=1na+becεi-i编写lingo程序写出相应的LINGO程序如下:sets:quantity/1..15/:x,y;endsetsdata:x=2,5,7,10,14,19,26
3、,31,34,38,45,52,53,60,65;y=54,50,45,37,35,25,20,16,18,13,8,11,8,4,6;enddatamin=@sum(quantity:@abs(a+b*@exp(x*c)-y));@free(a);@free(b);@free(c);运行结果:Localoptimalsolutionfound.Objectivevalue:20.80640Extendedsolversteps:2Totalsolveriterations:643VariableValueReducedCostA3.3982670.0000
4、00B57.114610.000000C-0.4752126E-010.000000(3)最大偏差最小的方法编写程序:sets:quantity/1..15/:x,y;endsetsdata:x=2,5,7,10,14,19,26,31,34,38,45,52,53,60,65;y=54,50,45,37,35,25,20,16,18,13,8,11,8,4,6;enddatamin=@max(quantity:@abs(a+b*@exp(c*x)-y));@free(a);@free(b);@free(c);结果:Linearizationcomponen
5、tsadded:Constraints:91Variables:76Integers:30Localoptimalsolutionfound.Objectivevalue:2.774408Extendedsolversteps:38Totalsolveriterations:7654VariableValueReducedCostA2.8855940.000000B55.862460.000000C-0.4441314E-010.000000(4)画出散点图和曲线图编写matlab程序如下:>>x=[257101419263134384552536065];
6、y=[54504537352520161813811846];scatter(x,y,'k*');holdonx=0:0.1:100;y=2.43+exp(-0.0446*x).*57.33;plot(x,y,'g');xlabel('x');ylabel('y');holdonx=0:0.1:100;y=3.40+exp(-0.048*x).*57.11;plot(x,y,'r');xlabel('x');ylabel('y');holdonx=0:0.1:100;y=2.89+exp(-0.044*x).*55.86;plot(x,y,'b');xlab
7、el('x');ylabel('y');得到图形:分析:三条曲线的结果大致相同,但是略有差异。最小二乘法当回归残差满足正态分布时,它有很好的统计性质,但是他的回归性质不稳定。最小一乘法和最小二乘法近似,更靠近主流数据。最大偏差最小回归法因为受到最大平偏差的影响,曲线始终偏移。①非线性优化问题:(1)设汽油由桶A类原油和桶B类原油化合而成,民用燃料油由桶A类原油和桶B类原油化合而成,汽油广告费为元,民用燃料的广告费为元。由题意知道,汽油产量为桶,销量为桶;民用燃料油产量为桶,销量为桶。约束条件:销售约束:,原料约束:,指标约束:,目标函数:利润:编写lingo
8、程序如下:max=0.5*z1*250+z2*200