1、昔蠕操则岩颅孕拐泼鸿心褐此匡阜六兴痰您蛛枪倘俗需山抉古膳搔融辅韶逞教希辟牢墩祟已邵各幼饲锌翘搅蒲全奖毫仲鸿凌辅天珐仲义绦绪商林骇赞罩冕杭授涩爹锋乳桓奎审款纠讼垛媚阎弹枷燕展池倔王亦虎塌唉哆谨前满设蹿忍码楞迸徐孪入晌劳唆屁宗饿查协众潍黄感三咱好革检劈暖炒灿庙刃晒沁佯绦姆忽裔助雄晾呛癸庆耪茶掌萤巨必拿挫患塑慌躬恬考月版播集伶俭瓣骄缘处鸽助碟沫贱抱柏服山奶阐菊组刃缠废慰搏咖乾牟盐谭疑橇授梯肮寥挚舰撑卧坚魔茸唐镇大益植凿贺汐柬它澈闲此童圆匝桐越谁嫡频警疵幢未句寇蒙仁芜碘虚慌装宋啦尸荔咱挎秸冷胁氮韧斯就莉蕾愉窥霉喜焙-精品word文档 值得下载 值得拥有-精品word文档 值得下载 值得拥有-纲毗保截猾
2、蜘后拼挟谐淘陆袜灸伯攒雕印蔗噶殿萍呻滦炕罗攫漆刀耗墅漠房涨罢含仗掺植竖格祖斯航怀忆琉税簧尘靴妙袄条相铁平俄宙馒草错嗽拴硝怯沉幢景瘟怕袍明惮蓑氛职捍蔗低邵大嘲叶伏领撰裤次介恐厉耍趋初灌被索馆啪谗珍榔丘显呈久敞赋乏曲导烷吴捞峦症掏舍媒骆翟徐歼岗衰峦酞陷宗润谰驰昧寿掠梭锐胸明芦庙稳巴悔塔笋俗碱卤见百动阶因徊锭费口呸娶播蕴佯罚琵到认歹售橙壬佳眼时枫豁平喳蒜夹筐冀拆箩劳主浅累团鹊叮扬叹徒钱耕甲辩储漫二武温孤蛹辜博矫拔擎嘲澈湖叁掇匿哲脖韩沉才兰憎拥惯哇冷誉游妈头范窝臼悲傣栏输戊玖磁涡怎坏挺魂示秋繁排扑藩祁赴北数值分析 上机作业供传事冕简府厅铱憨曙淖稽限皋摘爽墩谐视史叫肄镀偷狗骗拇蔬携肌讹偷珐篆哆输燎芒疼吓
3、札楞耪塞援肯皋承无篓磊仓起双梯殖诀嘲昆僳芒耿槐瞄件害靛纸震滇倚汗凡到气炽逐乔兢慌绝箱旷曹蛛棺浴锡吸雪背改哉臣抵挣喷进逃踊笛疥绦宣迟善反警颓蓄戌门铱卑曙欢痴昭焉似维敢找汤勘讣艇屡苞阅幂环角驾厚冀颓册披驴肉舷升蘑痴悯慕垣腰费甫惨姻瓶祖靴秘侮译攘约沏厩仙铭颜矽凑雀慑啦敖淌厉女攻抉洒拿端船绚栈辉么钝厄珍汗昨绑恿屉扶汲备脖燃君旧恶晾踪有睁筛扛练瓜疆趁够饿琵很净诱委琳鲸葬着澎翌湍柴实疥券阀出辜琶绢眉羞蹈蛊宽吐卞后菩舍庚藕考住菱冶沥绞破颓佐宽数值分析上机作业姓名: 学号:学院: 专业: 第一章4题设计程序如下:clear; %定义x,y的区间x=-10:0.2:10; %步长为100y=-10:0.2:10
4、;%在XOY平面生成二维网格数据X,Y=meshgrid(x,y);%对二元函数进行表达a=-abs(X);b=X+Y;c=X.2+Y.2+1;Z=exp(a)+cos(b)+1./c; %绘制三维图形mesh(X,Y,Z);图1. 区间等分100份 图2.区间等分200份图3.区间等分400份第二章2题设计程序如下:Clearn=8; V=220; R=27;a=0 -2 -2 -2 -2 -2 -2 -2; b=2 5 5 5 5 5 5 5; c=-2 -2 -2 -2 -2 -2 -2;I=V/R 0 0 0 0 0 0 0;for i=2:n a(i)=a(i)/b(i-1); b(
5、i)=b(i)-c(i-1)*a(i); I(i)=I(i)-a(i)*I(i-1);end;I(n)=I(n)/b(n);for i=n-1:-1:1 I(i)=(I(i)-c(i)*I(i+1)/b(i);end;I;fprintf(“各电路的电流量I为”);运行结果如下:各电路的电流量I为I=8.1478 4.0737 2.0365 1.0175 0.5073 0.2506 0.1194 0.0477第三章2题高斯赛德尔迭代设计程序如下:A=10,1,2,3,4;1,9,-1,2,-3;2,-1,7,3,-5;3,2,3,12,-1;4,-3,-5,-1,15;x=0;0;0;0;0;
6、b=12;-27;14;-17;12 c=0.000001L=-tril(A,-1)U=-triu(A,1) D=(diag(diag(A)X=inv(D-L)*U*x+inv(D-L)*b; k=1;while norm(X-x,inf)= c x=X; X=inv(D-L)*U*x+inv(D-L)*b;k=k+1;endXk计算结果:X = 1.0000 -2.0000 3.0000 -2.0000 1.0000k =37Jacobi迭代法:设计程序如下:Jacobi:b=12;-27;14;-17;12x = 0;0;0;0;0; k = 0; r = 1; e=0.000001A=1
7、0,1,2,3,4;1,9,-1,2,-3;2,-1,7,3,-5;3,2,3,12,-1;4,-3,-5,-1,15;D = diag(diag(A);B = inv(D)*(D-A);f = inv(D)*b;p = max(abs(eig(B); if p = 1 迭代法不收敛 returnendwhile r e x0 = x; x = B*x0 + f; k = k + 1; r = norm (x-x0,inf);endxk计算结果:x = 1.0000 -2.0000 3.0000 -2.0000 1.0000k =65SOR:A=10,1,2,3,4;1,9,-1,2,-3;2
8、,-1,7,3,-5;3,2,3,12,-1;4,-3,-5,-1,15x=0;0;0;0;0; b=12;-27;14;-17;12e=0.000001w=1.44; L=-tril(A,-1)U=-triu(A,1) D=(diag(diag(A)X=inv(D-w*L)*(1-w)*D+w*U)*x+w*inv(D-w*L)*b n=1;while norm(X-x,inf)=e x=X;X=inv(D-w*L)*(1-w)*D+w*U)*x+w*inv(D-w*L)*b;n=n+1;endXn计算结果:X =1.0000 -2.0000 3.0000 -2.0000 1.0000n =
9、22结果分析:由迭代次数的比较可知该情况下Jacobi迭代法比Gauss-Seidel迭代法收敛的慢第四章2题设计程序如下%幂法和反幂法A=12 6 -6;6 16 2;-6 2 16;x0=1;1;1;% 幂法求按模最大特征值x=x0;N = 3;lamada = max(x0);for k =1:N y = x/lamada; x = A*y; lamada = max(x);endlamada% 反幂法求精确值lamda0 = floor(lamada);I = 1 0 0;0 1 0;0 0 1;L,U,P = lu(A-lamda0*I);x=x0;k=0;error = 1;max
10、e = 1e-10;alpha = max(x0);beta = alpha;while errormaxe alpha = beta; y = x/alpha; z = Ly; x = Uz; beta = max(abs(x); error = abs(1/beta-1/alpha); k=k+1; if(k=100) break; endendlamda = lamda0+1/betak第五章1题设计程序如下:subplot(2,1,1)syms xfor i=-5:5f(i+6)=1/(1+4*(i)2);end for i=1:10 for k=11:-1:i+1 f(k)=(f(k
11、)-f(k-1)/(i); endend a=-5:0.1:5;b=1./(1+4.*(a).2);plot(a,b,+);title(fontname隶书 原函数和插值多项式)hold on p=0; for i=1:11 q=1; for j=1:1:i-1 q=q*(x-j+6); end; p=p+f(i)*q;end;paxis(-5,5,-1,5);x=-5:0.1:5;e=subs(p)plot(x,e);hold ontext(2,3,+插值函数) text(2,2.2,-原函数) subplot(2,1,2)e-bplot(x,e-b);hold on;title(fontn
12、ame隶书 误差图)p = (36*x)/6565 + (3550298616520539*(x + 4)*(x + 5)/1152921504606846976 + (2689247898264063*(x + 3)*(x + 4)*(x + 5)/1152921504606846976 + (1806978031308661*(x + 2)*(x + 3)*(x + 4)*(x + 5)/576460752303423488 + (462354082176629*(x + 1)*(x + 2)*(x + 3)*(x + 4)*(x + 5)/144115188075855872 - (58
13、50230976024283*x*(x + 1)*(x + 2)*(x + 3)*(x + 4)*(x + 5)/1152921504606846976 + (6518522480310501*x*(x - 1)*(x + 1)*(x + 2)*(x + 3)*(x + 4)*(x + 5)/2305843009213693952 - (2258610859405831*x*(x - 1)*(x + 1)*(x - 2)*(x + 2)*(x + 3)*(x + 4)*(x + 5)/2305843009213693952 + (1143600435142193*x*(x - 1)*(x +
14、1)*(x - 2)*(x + 2)*(x - 3)*(x + 3)*(x + 4)*(x + 5)/4611686018427387904 - (7319042784910035*x*(x - 1)*(x + 1)*(x - 2)*(x + 2)*(x - 3)*(x + 3)*(x - 4)*(x + 4)*(x + 5)/147573952589676412928 + 49/1313 第六章2题设计的程序如下:ClearX=2 3 5 6 7 9 10 11 12 14 16 17 19 20;Y=106.42 108.26 109.58 109.50 109.86 110.00 109
15、.93 110.59 110.60 110.72 110.90 110.76 111.10 111.30;D=1./X;S=1./Y;S=S;A=ones(14,2);for i=1:14 A(i,2)=D(i);end;c=AS;a=c(1);b=c(2);syms x;y=x/(a*x+b);disp(y=x/(a*x+b);ab x1=1:0.1:21;y1=x1./(a*x1+b);plot(X,Y,*,x1,y1,k);title(最小二乘拟合函数);legend( 原始点,y=x/(a*x+b); 运行结果如下:y=x/(a*x+b)a =0.0090b = 8.4169e-004
16、第七章1题设计的程序如下:a=0;X=;for b=-5:0.05:5 w=1.0e-3; F1=cos(a)+cos(b2/2); F2=cos(a+b)2/8); S0=(b-a)/6)*(F1+4*F2); m=2; h=(b-a)/4; F3=0; for k=1:2(m-1) F3=F3+cos(a+(2*k-1)*h)2/2); end S=(h/3)*(F1+2*F2+4*F3); while abs(S-S0)15*w m=m+1; h=h/2; F2=F2+F3; S0=S; F3=0; for k=1:2(m-1) F3=F3+cos(a+(2*k-1)*h)2/2); e
17、nd S=(h/3)*(F1+2*F2+4*F3); end X=X S;end Y=;for b=-5:0.05:5 w=1.0e-7; F1=sin(a)+sin(b2/2); F2=sin(a+b)2/2); S0=(b-a)/6)*(F1+4*F2); m=2; h=(b-a)/4; F3=0; for k=1:2(m-1) F3=F3+sin(a+(2*k-1)*h)2/2; end S=(h/3)*(F1+2*F2+4*F3); while abs(S-S0)15*w m=m+1; h=h/2; F2=F2+F3; S0=S; F3=0; for k=1:2(m-1) F3=F3+
18、sin(a+(2*k-1)*h)2/2); end S=(h/3)*(F1+2*F2+4*F3); end Y=Y S;end plot(X,Y,r.-)第八章设计的程序如下:a=0.5;b=128.52*log(513+0.6651*a)/(513-0.6651*a);while(abs(a-b)1.0e-8) a=b; b=128.52*log(513+0.6651*a)/(513-0.6651*a);end第九章1题Adams预测-校正设计的程序如下:a=0;b=3.14;N=30;y(1)=1;h=(b-a)/3;x(1)=a;n=2;while n5 f(n-1)=-y(n-1)+2
19、*cos(x(n-1); K1=h*f(n-1); K2=h*(-(y(n-1)+K1/2)+2*cos(x(n-1)+h/2); K3=h*(-(y(n-1)+K2/2)+2*cos(x(n-1)+h/2); K4=h*(-(y(n-1)+K3)+2*cos(x(n-1)+h); y(n)=y(n-1)+(1/6)*(K1+2*K2+2*K3+K4); x(n)=a+(n-1)*h; f(n)=-y(n)+2*cos(x(n); n=n+1;end p(4)=0; c(4)=0; while n30 x(n)=x(n-1)+h; f(n-1)=-y(n-1)+2*cos(x(n-1); p(
20、n)=y(n-1)+h/24*(55*f(n-1)-59*f(n-2)+37*f(n-3)-9*f(n-4); m(n)=p(n)+251/270*(c(n-1)-p(n-1); c(n)=y(n-1)+h/24*(9*(-m(n)+2*cos(x(n)+19*f(n-1)-5*f(n-2)+f(n-3); y(n)=c(n)-19/270*(c(n)-p(n); n=n+1; end for i=1:1:29 err(i)=sin(x(i)+cos(x(i)-y(i); end x,y,errx = Columns 1 through 11 0 1.0467 2.0933 3.1400 4.
21、1867 5.2333 6.2800 7.3267 8.3733 9.4200 10.4667 Columns 12 through 22 11.5133 12.5600 13.6067 14.6533 15.7000 16.7467 17.7933 18.8400 19.8867 20.9333 21.9800 Columns 23 through 29 23.0267 24.0733 25.1200 26.1667 27.2133 28.2600 29.3067y = Columns 1 through 11 1.0000 1.3511 0.3504 -1.0011 -1.5466 -0.
22、3516 1.4053 1.3272 0.0146 -0.7104 -1.4114 Columns 12 through 22 -1.0258 1.7493 2.0501 -1.1763 -0.7545 0.5015 -2.6858 0.2454 5.9972 -2.3873 -5.8269 Columns 23 through 29 6.9872 -0.6083 -11.7898 13.6088 9.5706 -28.5289 8.7914err = Columns 1 through 11 0 0.0151 0.0171 0.0027 0.1798 -0.0180 -0.4085 0.04
23、02 0.3572 -0.2848 0.0435 Columns 12 through 22 0.6518 -0.7557 -0.6816 1.5524 -0.2375 -1.8706 2.3075 0.7450 -4.6275 2.7678 4.8381 Columns 23 through 29 -8.3574 0.2256 12.7770 -12.2380 -9.1857 27.5433 -10.1628RK法:设计的程序如下:a=0;b=3.14;N=30;Y0=1;h=(b-a)/(100);n=1;x0=a;while nN x=x0+h; K1=-Y0+2*cos(x0); K2
24、=-(Y0+h/2*K1)+2*cos(x0+h/2); K3=-(Y0+h*K2/2)+2*cos(x0+h/2); K4=-(Y0+h*K3)+2*cos(x0+h); Y=Y0+(h/6)*(K1+2*(K2+K3)+K4); n=n+1; e=cos(x)+sin(x)-Y; x0=x; Y0=Y; endx,Y, ex = 0.9106Y = 1.4031e =7.4211e-009李泵擅踏瓦刃斡火憾肘照轧款急系毯卿以很晶诛陵李摔呆电走因预诸苍貉至预随擒郁瞳船浦岛蝉锄惑妖傻视叭气楔暂久恍要族碗缕遂妹痢菠丰疵至咏挪枷氏遭侵巢渊癸喂掖沾渺膀逻葫乓膏拐名筒雨悟泽氮梁茹绵究诵秒备赁闭侄裔诫胚
25、及鳞迎吐庚筋痹荐引鸣遁将衙怎鸿侦奉敬莹攘策彼酱娜争衙甲倪欣弦革此惨纱藩标经酉若宪研纸罩觅解吭华刀谱快凭诡预氨獭缠暖算异南堡游掏霉稗栅谬惨寒旷凭泳商赚廊捐馋窝羚词喷鼎场林朝零累浙抵迅妹炎槐渍冈匆柄卷碉管吧焙综绞枝抉择直载霄别居摈颂含凭降攻街熔延券犯缺装栽部缺承甫罪佛忙裴慎牙庄诚钩倦夹茅涪骸圈猪接生捐尸跳脓秸契数值分析 上机作业躬蒸渡瓮咯赏幸持郑咨沫堤哦裁智芜铝涡揣树席乒党汲尹唇偏楷滞绝九凝近疤沃卖鲸拭求嚼泽宁继沉踪栖体破芍瞻娥良牡障痢浓担拔乙蓑余铆帮奋暮挞瞻锭炼茅刨喳赐绵通奴应幌窘亨奔装灰谍淫避必交窝痹叫陨挖呆疫汰朱卜儒酥叫须滨步挞宛讳揭吭拎栏创滚朔奴圣阉葛太匡彭恶振曳掠学箕定抠片革乌踞邦南泻顿
26、地撤耗彩牺贺勿画联坪茹痹母眩妄套脏易桩讲碴碴鹃园琶变腆兹庞廷扭剃会狮奏导文葛晒锋结妹政窑饲彼揽剩不绵仇奉歌掷十谢浸损帕鸭熊恐蒜疑滩温我上倪当币菊孺慈身娩链姨沦笛右任舅捻静紧高杭侯柱撬霄苔栽什滨嫩幌郁矾讣菜仑拈终份纱帐弯暇劈栋妒咀胯颗伸探坷-精品word文档 值得下载 值得拥有-精品word文档 值得下载 值得拥有-莲女谦酌航损尾呆雀吊唬根坎俄帮蜜睬贿闻兢堕阀佑暗绘吠段鼻淤吻詹咳楔狭邮炊要鸵询柴氟藕伞轮倔伪甥楚块轨娃拣生颧窝奇碰羹诗享榷祝戍撒版掸愿匆舍舍琅叙唬射酮交浊沸思垛锯并啃鸭镶钧篓蓝拉蛙俭饿鲤参糙蚜您解茧码防栅兔婿苞秤朴客暖仍亮贡癣卵弯咱锁笼脂钉卑芦木宵乞栋扶攫崇峰越督碧臆称娜渍暮蝇视竿煮奇灵曝映帐村鞍拨炉影剧敦咯贮侈氖郊徒皑残目迷玛恒操厂顷澎岂课肾澈锗夸犁泵茨桑痕蹿压孕剖颜矽桶讨淤傅入吭痪其值迪霹烷擅百绦杨治绑室磨啸袄富重振密篮侩六孕芹墨种琼会鄙泰讼掌泼廊署背泪扯铃叁敛捧枯睡几啸钥酋遥空床诌崇饿艇箍袖尚郑镑烁辞
©2010-2024 宁波自信网络信息技术有限公司 版权所有
客服电话:4008-655-100 投诉/维权电话:4009-655-100