matlab实验报告

上传人:第*** 文档编号:31078683 上传时间:2018-02-04 格式:DOC 页数:12 大小:159.78KB
返回 下载 相关 举报
matlab实验报告_第1页
第1页 / 共12页
matlab实验报告_第2页
第2页 / 共12页
matlab实验报告_第3页
第3页 / 共12页
matlab实验报告_第4页
第4页 / 共12页
matlab实验报告_第5页
第5页 / 共12页
点击查看更多>>
资源描述

《matlab实验报告》由会员分享,可在线阅读,更多相关《matlab实验报告(12页珍藏版)》请在金锄头文库上搜索。

1、1电 子 科 技 大 学 电 子 工 程 学 院标 准 实 验 报 告( 实 验 ) 课 程 名 称 MATLAB与 数 值 分 析 学 生 姓 名 : 学 号 : 指 导 教 师 : 2实 验 目 的通过上机编程实验,使学生熟悉对 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

2、(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:nx(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 po

3、ints:10input a:1input b:2input x1:3input x2:432.编程实现奥运 5 环图,允许用户输入环的直径。hold onr=input(shuru r:);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);

4、X=r*cos(jiao)+x;4Y=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); 输入:shuru r:453.A=input(input numbers: ); m,n=size(A); for i=1:nfor j=

5、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;endendend 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. 对高阶多项式 20112kpxxxL编程求下面方程的解 190px并绘图演示方程的解与扰动量 的关系。p=1,-1;for i=2:20n=1,-i;p=conv(p,n); endm=zeros(1,21); 6hold onx=1:20;d=-1,0,0.

6、1,0.5,1;for i=1:5delt=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)结果:0 2 4 6 8 10 12 14 16 18 200102030405060 与与p(x)=0与与与与与与delt与与与delt=-1delt=0delt=0.1delt=0.5delt=12.对 ,生成对应的 Hilbert 矩阵,计算矩阵的条件数;通过先确

7、定解20n:获得常向量 b 的方法,确定方程组 nHxb7最后,用矩阵分解方法求解方程组,并分析计算结果。for n=2:20h=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:nfprintf(%-8.2f,X(i)endfprintf(n x=)for i=1:nfprintf(%-8.2f,x(i)endend运行结果:n=2 cond(Hn)=2.700000e+001X=1.00 2.00 x=1.00 2.00 n=3

8、 cond(Hn)=7.480000e+002X=1.00 2.00 3.00 x=1.00 2.00 3.00 n=4 cond(Hn)=2.837500e+004X=1.00 2.00 3.00 4.00 x=1.00 2.00 3.00 4.00 n=5 cond(Hn)=9.436560e+005X=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+007X=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

9、 cond(Hn)=9.851949e+008X=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 8n=8 cond(Hn)=3.387279e+010X=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+012X=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.

10、00 5.00 6.00 7.00 8.00 9.00 n=10 cond(Hn)=3.535369e+013X=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+015X=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、11.00 Warning: Matrix is close to singular or badly scaled.Results may be inaccurate. RCOND = 2.692153e-017. In cond at 48In Untitled7 at 3n=12 cond(Hn)=3.714499e+016X=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 Warni

12、ng: Matrix is close to singular or badly scaled.Results may be inaccurate. RCOND = 2.739612e-018. In cond at 48In Untitled7 at 3n=13 cond(Hn)=3.650152e+017X=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 48In Untitled7 at 3n=14 cond(Hn)=4.084635e+018Warning: Matrix is close to singular or badly scaled.9Results may be inaccurate. RCOND = 4.455948e-017. In Untitled7 at 7X=

展开阅读全文
相关资源
相关搜索

当前位置:首页 > 办公文档 > 解决方案

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号