




已阅读5页,还剩7页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
电子科技大学 电子工程 学院标 准 实 验 报 告(实验)课程名称 MATLAB与数值分析 学生姓名: 学 号: 指导教师: 实验目的通过上机编程实验,使学生熟悉对MATLAB软件平台的使用,使学生掌握MATLAB的编程技巧,让学生对MATLAB软件平台在科学计算中的重要作用有深入了解Matlab实验报告1 第一次 1.1. 编程实现以下数列的图像,用户能输入不同的初始值以及系数。并以x,y为坐标显示图像x(n+1) = a*x(n)-b*(y(n)-x(n)2);y(n+1) = b*x(n)+a*(y(n)-x(n)2)n=input(input the number of pionts:);a=input(input a:);b=input(input b:);x=;y=;x(1)=input(input x1:);y(1)=input(input y1:); for i=2:n x(i)=a*x(i-1)-b*(y(i-1)-x(i-1)2);y(i)=a*x(i-1)+b*(y(i-1)-x(i-1)2); endfigure;plot(x,y,linewidth,2)axis equal text(x(1),y(1),1st point) 输入数据:input the number of points:10input a:1input b:2input x1:3input x2:42.编程实现奥运5环图,允许用户输入环的直径。holdonr=input(shurur:);x=5;y=5;jiao=linspace(0,2*pi);X=r*cos(jiao)+x;Y=r*sin(jiao)+y;plot(X,Y,y,linewidth,5);x=10;y=5;jiao=linspace(0,2*pi);X=r*cos(jiao)+x;Y=r*sin(jiao)+y;plot(X,Y,g,linewidth,5);x=15;y=5;jiao=linspace(0,2*pi);X=r*cos(jiao)+x;Y=r*sin(jiao)+y;plot(X,Y,b,linewidth,5);x=7;y=2;jiao=linspace(0,2*pi);X=r*cos(jiao)+x;Y=r*sin(jiao)+y;plot(X,Y,r,linewidth,5);x=12;y=2;jiao=linspace(0,2*pi);X=r*cos(jiao)+x;Y=r*sin(jiao)+y;plot(X,Y,k,linewidth,5); 输入:shurur:43.A=input(input numbers:); m,n=size(A); for i=1:n for j=1:(n-i) if sort_A(j)sort_A(j+1) t=sort_A(j); sort_A(j)=sort_A(j+1); sort_A(j+1)=t; end endend sort_A输入数据:inpute number:2,4,5,8,7,3,1,0,6,9输出数据:Sort_A=0 1 2 3 4 5 6 7 8 92 第二次1. 对高阶多项式编程求下面方程的解并绘图演示方程的解与扰动量的关系。p=1,-1;for i=2:20 n=1,-i;p=conv(p,n); endm=zeros(1,21); hold onx=1:20;d=-1,0,0.1,0.5,1;for i=1:5 delt=d(i); m(2)=delt; y=(roots(p+m); plot(x,y,-o,color,i/5,i/20,i/10);endtitle(方程p(x)=0的解与扰动量delt的关系)legend(delt=-1,delt=0,delt=0.1,delt=0.5,delt=1)结果:2.对,生成对应的Hilbert矩阵,计算矩阵的条件数;通过先确定解获得常向量b的方法,确定方程组最后,用矩阵分解方法求解方程组,并分析计算结果。for n=2:20 h=hilb(n); fprintf(nnn=%-10dcond(Hn)=%d,n,cond(h,inf) X=1:n; b=h*X; l u=lu(h); x=u(lb); x=x; fprintf(n X=) for i=1:n fprintf(%-8.2f,X(i) end fprintf(n x=) for i=1:n fprintf(%-8.2f,x(i) endend运行结果:n=2 cond(Hn)=2.700000e+001 X=1.00 2.00 x=1.00 2.00 n=3 cond(Hn)=7.480000e+002 X=1.00 2.00 3.00 x=1.00 2.00 3.00 n=4 cond(Hn)=2.837500e+004 X=1.00 2.00 3.00 4.00 x=1.00 2.00 3.00 4.00 n=5 cond(Hn)=9.436560e+005 X=1.00 2.00 3.00 4.00 5.00 x=1.00 2.00 3.00 4.00 5.00 n=6 cond(Hn)=2.907028e+007 X=1.00 2.00 3.00 4.00 5.00 6.00 x=1.00 2.00 3.00 4.00 5.00 6.00 n=7 cond(Hn)=9.851949e+008 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 x=1.00 2.00 3.00 4.00 5.00 6.00 7.00 n=8 cond(Hn)=3.387279e+010 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 x=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 n=9 cond(Hn)=1.099652e+012 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 x=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 n=10 cond(Hn)=3.535369e+013 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 x=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 n=11 cond(Hn)=1.229476e+015 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 x=1.00 2.00 3.00 4.00 5.00 6.00 7.01 7.99 9.01 10.00 11.00 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.692153e-017. In cond at 48 In Untitled7 at 3n=12 cond(Hn)=3.714499e+016 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 x=1.00 2.00 3.00 4.00 5.03 5.87 7.34 7.38 9.72 9.48 11.22 11.96 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.739612e-018. In cond at 48 In Untitled7 at 3n=13 cond(Hn)=3.650152e+017 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 x=1.00 2.00 3.00 4.06 4.50 8.73 -2.56 30.28 -25.84 46.13 -12.84 21.06 11.49 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 2.448199e-019. In cond at 48 In Untitled7 at 3n=14 cond(Hn)=4.084635e+018Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 4.455948e-017. In Untitled7 at 7 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 x=1.00 2.00 2.97 4.44 2.03 15.85 -1.01 -51.32 265.98 -505.38 620.05 -421.65 185.67 -15.62 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.024999e-018. In cond at 48 In Untitled7 at 3n=15 cond(Hn)=9.756108e+017 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 x=1.00 2.00 3.00 4.06 4.46 8.92 -2.48 25.12 0.44 -24.72 105.39 -105.03 95.41 -17.82 20.26 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 9.721674e-019. In cond at 48 In Untitled7 at 3n=16 cond(Hn)=1.028629e+018Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.948463e-017. In Untitled7 at 7 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 x=1.00 2.00 3.00 4.03 4.72 7.62 1.07 21.31 -5.46 0.61 73.43 -98.66 124.04 -53.40 38.17 12.52 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.305919e-018. In cond at 48 In Untitled7 at 3n=17 cond(Hn)=1.038063e+018Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.798429e-016. In Untitled7 at 7 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 x=1.00 2.00 2.99 4.10 4.13 10.17 -4.82 26.20 0.84 -8.49 39.86 6.13 2.66 5.80 41.30 -2.06 21.18 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.076656e-019. In cond at 48 In Untitled7 at 3n=18 cond(Hn)=9.288018e+018Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 7.626119e-018. In Untitled7 at 7 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 x=1.00 2.00 3.01 3.80 7.66 -12.72 83.21 -172.57 233.93 -71.26 -41.44 -156.96 387.29 200.16 -1079.371233.14 -583.42 133.55 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.592243e-019. In cond at 48 In Untitled7 at 3n=19 cond(Hn)=6.280448e+018Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 6.040620e-017. In Untitled7 at 7 X=1.00 2.00 3.00 4.00 5.00 6.00 7.00 8.00 9.00 10.00 11.00 12.00 13.00 14.00 15.00 16.00 17.00 18.00 19.00 x=1.00 2.00 3.00 3.87 6.72 -6.04 56.65 -114.38 178.86 -96.36 43.65 -153.15 318.14 62.48 -704.50 954.66 -554.42 187.88 -0.06 Warning: Matrix is close to singular or badly scaled. Results may be inaccurate. RCOND = 1.155429e-019. In cond at 48 In Untitled7 at 3n=20 cond(Hn)=8.654794e+018Warning: Matrix is close to singular or badly scaled. Results
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 侨联业务培训课件
- 行政报务中心管理办法
- 1.2 人口 同步分层练(含答案)地理人教版八年级上册
- 出国前的安全培训课件
- 围手术期营养支持-洞察及研究
- 冰雪天气行车安全培训
- 疫情居家员工管理办法
- 企业安全专项培训内容课件
- 网络交易管理办法电话
- 罪犯信件检查管理办法
- 烹饪实训课安全教育
- 2023-2024学年江苏省南通市如皋市重点中学八年级(上)第二次月考数学试卷(含解析)
- 矿山安全供电讲义
- 最全婚礼筹备清单:婚礼流程婚礼采购必备清单
- 混龄教育完整版本
- GB/T 19520.21-2023电气和电子设备机械结构482.6 mm(19 in)系列机械结构尺寸第3-109部分:嵌入式计算设备的机箱尺寸
- 龙湖地产集团公司劳动合同范本
- 规范权力运行方面存在问题及整改措施范文(五篇)
- 土壤退化与生态恢复课件
- 山东省海洋知识竞赛(小学组)考试题库大全-上(单选题汇总)
- 宝安区人民医院药品目录西药
评论
0/150
提交评论