中南大学matlab课后习题(七).pdf

上传人:奔*** 文档编号:89654977 上传时间:2023-05-08 格式:PDF 页数:40 大小:3.06MB
返回 下载 相关 举报
中南大学matlab课后习题(七).pdf_第1页
第1页 / 共40页
中南大学matlab课后习题(七).pdf_第2页
第2页 / 共40页
点击查看更多>>
资源描述

《中南大学matlab课后习题(七).pdf》由会员分享,可在线阅读,更多相关《中南大学matlab课后习题(七).pdf(40页珍藏版)》请在taowenge.com淘文阁网|工程机械CAD图纸|机械工程制图|CAD装配图下载|SolidWorks_CaTia_CAD_UG_PROE_设计图分享下载上搜索。

1、第一章思考练习1.与一般的Windows程 序样,启动MATLAB系统有3种常见方法:(1)使用Windows“开始”菜单。(2)运 行MATLAB系统启动程序matlab.exe。(3)利用快捷方式。要退出MATLAB系统,也有3种常见方法:(2)在MATLAB命令窗口输入Exit或Quit命令。(3)单 击MATLAB主窗口的“关闭”按钮。2.matlab用于算法开发、数据可视化、数据分析以及数值计算的高级技术计算语言和交互式环境,主要包括MATLAB和Simulink两大部分。它将数值分析、矩阵计算、科学数据可视化以及非线性动态系统的建模和仿真等诸多强大功能集成在一个易于使用的视窗环境中

2、,为科学研究、工程设计以及必须进行有效数值计算的众多科学领域提供了一种全面的解决方案3.可以在第一个物理行之后加上三个小黑点并按回车键,然后再下一个物理行输入其他部分。4.help命令会显示当前帮助系统中的所有项目,即搜索路径中所有的目录名称,只显示那些与关键字中完全匹配的结果。Lookfor命令对搜索范围内的M文件经行搜索,条件比较宽泛。第二章(1)w=sqrt(2)*(1+0.34245*10A(-6)(2)a=3.5b=5c=9.8x=(2*pi*a+(b+c)/(pi+a*b*c)exp(2)/(tan(b+c)+a)(3)a=3.32b=7.9y=2*pi*aA2*(1-pi/4)*

3、b-(0.8333-pi/4)*a)(4)t=2,l-3i;5,-0.65JZ=0.5*exp(2*t)*log(t+sqrt(l+t.*t)2.A=-1,5,-4;0,7,8;3z 61,7;B=8,3,T;2,5,3;-3,2,0;(1)A+6*B AA2-B+eye(2)A*B A.*B B.*A(3)A/B BA(4)A,B A(1A3 ,:);B-23.(1)A=23,10,-0.778,0;41,-45,65,5;32,5,0,32;6,-9.54,54,3.14;K=find(A10&A25);A(K)(2)A=23,10,-0.778,0;41,-45,65,5;32,5,0,

4、32;6,-9.54,54,3.14;B=A(1:3,:)C=A(:z1:2)D=A(2:4Z3:4)E=B*C(3)E=90&score=80&score=70&score=60&score=69;disp(D);elseif score=0;disp(*E);elsedisp(,出错,);End(2)用 switch语句score=input(请 输 入 成 绩:;switch fix(score/10)case 9,10disp(*A);case 8disp(*B);case 7disp(e);case 6disp(*D);case 0,1,2,3,4,5disp(lE);otherwi

5、sedisp(1 出错,);End3.b=max(a)c=min(a)b=0c=0f o r i=l:20if a(i)bb=a(i);e n dif a(i)5n=5A(n,n)e ls eA(n)7.f l.m 代码:f u n c t io n m=f 1(n)m=n+10*lo g(r T 2+5);f 2.m 代码:f u n c t io n m=f 2(n)m=0;f o r i=l:nm=m+i*(i+l);e n d在命令文件p3L m中调用f l.m和f 2.mp3_ ll.m代码如下:y l=f 1(40)/(f l(30)+f 1(20);y 2二 f 2(40)/(f

6、 2(30)+f 2(20);y ly 21008.Z 4 函数文件f ac t o r l.m代码如下:k=f u n c t io n f=f ac t o r l(k)if k=lf=l;e ls ef=f ac t o r 1(k-1)+k;e n d50Z%八 2 函数文件f ac t o r 2.m代码:k=f u n c t io n f=f ac t o r 2(k)if k=lf=l;e ls ef=f ac t o r 2(k-D+2;e n d10函数文件f ac t o r 3.m代码:k=f u n c t io n f=f ac t o r 3(k)if k=lf=

7、l;e ls ef=f ac t o r 3(k-l)+l/k;e n d思考练习2.N=1,2,3,4,5A=N.*2B=N./4C=l./ND=1./(N./2)./(N./2)/43.B=0f o r i=l:20A(i)=f ix(99-10+1)*r an d(1)+10);B=A +B;e n dB=B/20f o r i=l:20if A(i)B&r e m(A(i),2)=0A(i)e n d第四章.1.(l).x=-12:0.001:12;y=x-x.-3/6;plo t (x,y);x labe l(x 轴);y labe l(y 轴);t it le,Y=X X 3/3!

8、);(2)t=0:0.01:2*pi;x=8.*cos(t);y=4*sqrt(2).*sin(t);plot(x,y)2.t=-pi:pi/10:pi;y=l./(l+exp(-t);subplot(2,2,1);bar(tz y,b!);title(bar(t,yz 1 1b*),);axis(-5,5,-3z 3);subplot(2,2,2);stairs(t,y,*k*);title(stairs(t,yz 1 1k )1);axis(-5,5,-3Z 3);subplot(2,2,3);stem(tz y,m*);title(stem(tz y,*m1 1);axis(-5,5,-

9、3f 3);subplot(2,2,4);loglog(tAy,*g*);title(*loglog(t,yz 1*g*);axis(5,5,-3,3);3.(1)t=0:pi/100:2*pi;y=5*cos(t)+4;polarity;-*)(2)t=-pi/3:pi/100:pi/3;r=5*sin(t).A2./cos(t);polarftj;-*)4.(l)t=0:pi/100:2*pi;x=exp(-t/20).*cos(t);y=exp(-t/20).*sin(t);z=t;plot3(x,y,z)(2)x,y=meshgrid(-5:5);z=ones(ll);s u r f(

10、x,y,z);s hadin g in t e r p;5.x,y,z =s phe r e (50);m=mo v ie in(100);f o r i=l:100s u r f(i*x,i*y,i*z);s hadin g in t e r pc o lo r map(ho t);ax is e qu alax is (-100,100,-100,100,-100,100)ax is o f fm(:,i)=ge t f r ame;E n d思考练习2.(1)x=l:0.1:10a=e x p(x.*2)/2)y=a.*l/2/piplo t (x,y)(2)t=-pi:0.l:2*pi

11、X=t.*s in(t)Y=t.*c o s(t)plo t (X,Y)3.t=0:0.00005:pi;x=s in(3*t).*c o s(t);y l=2*x-0.5;y 2=s in(3*t).*s in(t);plo t (x,y 2,x,y l);ho ld o nk=f in d(abs(y 2-y l)le-4);x l=x(k);y 3=2*x l-0.5;plo t (x l,y 3,r p)4.x=-pi*6:0.l:pi*6y=s in(l./x)plo t (x,y)f plo t C s in(l./x)f,-pi*6,pi*6,le-4)5.(1)x=l:0.1:

12、10y=12./xpo lar (x,y)(2)x=-pi/6:0.l:pi/6y=3*s in(x).*c o s(x)./(s in(x).3+c o s(x).3)po lar (x,y)6.(1)u,v =me s hgr id(-pi:pi/100:pi);x=3*u.*s in(v);y=2*u.*c o s(v);z=4*u.*u;me s h(x,y,z);(2)x,y =me s hgr id(-3:6/100:3);z=-5./(1+x.*x+y.*y);me s h(x,y,z)第五章1.A=randn(10,5)(1)X=mean(A)Y=std(A,O4)(2)max

13、(max(A)min (min (A)(3)B=sum(A,2)s u m(4)sort(A);sort(A,2/descend)2.(1)t=0:15:90;xl=0,0.2588,0.5000,0.7071,0.8660,0.9659,1.0000;al=0:l:90;yl=interpl(t,xl,al,spline)x 2=0,0.2679,0.5774,1.0000,1.7320,3.7320,N aN ;a2=0:1:75;y2=interpl(t,x2/a2/spline)pl=po ly f it (t,x l,5);Z l=po ly v al(pl,al)p2=po ly

14、f it(t,x 2,5);z 2=po ly v al(p2,a2)(2)X=l 4 9 16 25 36 49 64 81 100J;Y=l:10;Xl=l:100;Yl=interpl(X,Y,Xl;cubic,)3.4.P=2,-3,5,13;Q=l,5,8;p=po ly de r(P)pl=po ly de r(P,Q)p,q=po ly de r (P,Q)5.P 1=1,2,4,0,5;P 2=l,0;P 3=l,2,3;l)P 4=c o n v(P 2,P 3)P 4=0,1,2,3,0;P=P 1+P 42)x=r o o t s(P)3)A=-1,1.2,-1.4;0,

15、75,2,3,5;0,5,2.5;Y=po ly v al(P,A)4)Z=po ly v alm(P,A)第六章1.(1)A=l/2,l/3,l/4;l/3,1/4,l/5;l/4,l/5,l/6;B=0.95,0.67,0.52*;x=AB(2)A=l/2,1/3,l/4;l/3,1/4,l/5;l/4,l/5,l/6;B=0.95,0.67,0.53,;x=AB(3)cond(A)2.(1)建立函数文件fim x.m,命令如下;Function fx=funx(x)fx=xA41+xA3+l;调用fzero函数求根,命令如下;z=fzero(funx,-l)(2)建立函数文件sin.m,

16、命令如下;Function fx=sin(x)fx=x(sin(x)/x;调用fzero函数求根,命令如下;z=fzero(sin,0.5)(3)建立函数文件myfun.m,命令如下;f u n c t io n q=my f u n(p)x=p(l);y=p(2);z=p ;q(l)=s in (x)+y x=sym(,x,);f=exp(x)*(exp(x)+1 )A2;int(f,0,log(2)ans=(exp(6243314768165359/9007199254740992)*(3*exp(6243314768165359/9007199254740992)+exp(6243314

17、768165359/4503599627370496)+3)/3-7/34 x=sym(,x,);f=x*log(x);int(f,l,exp(l)ans=(9366741398929500034245406117369*log(3060513257434037/1125899906842624)/25353012004564588029934064107528099090798701270632748702911993/50706024009129176059868128215045 求级数和1 syms n;s=symsum(-1 )An+1 )/n,1 ,inf)Inf2 syms n;

18、s=symsum(xA2*n-l/2*n-1,1,inf)s=Inf*n-Inf*(n/2+1)6 求泰勒展开式1 syms x;fl=(exp(x)+exp(-x)/2;taylor(f 1,5,0)In sym.taylor at 97ans=xA4/24+xA2/2+12 syms x;fl=sqrt(xA3-2*x+1);taylor(f 1,6,0)Warning:The syntax of TAYLOR has changed.The old syntax is partially supported in thisrelease,butwill be removed in a f

19、uture release.Second argument must be a variable.See doc taylor fordetails.In sym.taylor at 97ans=-xA5/8-xA4/8-xA2/2-x+17 求非线性方程的符号解1 syms x y z a;x=solve(,xA3+ax+1 =0,x)x=(-ax-1)八(1/3)(3A(l/2)*i)/2-1/2)*(-ax-l)A(l/3)-(3A(l/2)*i)/2+l/2)*(-ax-l)A(l/3)2 syms x y z a;solve(,sinx4-2*cosx-sqrt(x),x,)ans=

20、(2*cosx+sinx)八 22x y=solve(log(x/y)=9,exp(x+y)=3,x,y)x=(exp(9)*log(3)/(exp(9)+1)y=log/(exp +1)8求微分方程初值syms x y z a n;x y=dsolve(x*D2y+(1 -n)*Dy+y=0/Dy(0)=y(0)=0,x,)Warning:Explicit solution could not be found.In dsolve at 194x=empty sym y=J思考练习i符号运算可以自动合并同类项及化简数值运算不含未知数2 x=sym(,x,);y=2*(cos(x)A2-(si

21、n(x)A2y=2*cos(x)A2-sin(x)A2 simple(y)simplify:2-3*sin(x)A2radsimp:2*cos(x)A2-sin(x)A2simplify(lOO):3*cos(x)A2-1combine(sincos):(3*cos(2*x)/2+1/2combine(sinhcosh):2*cos(x)A2-sin(x)A2combine(ln):2*cos(x)A2-sin(x)A2factor:2*cos(x)A2-sin(x)A2expand:2*cos(x)A2-sin(x)A2combine:2*cos(x)A2-sin(x)A2rewrite(e

22、xp):2*(exp(-x*i)/2+exp(x*i)/2)A2-(exp(-x*i)*i)/2-(exp(x*i)*i)/2)A2rewrite(sincos):2*cos(x)A2-sin(x)A2rewrite(sinhcosh):2*cosh(x*i)A2+sinh(x*i)八 2rewrite(tan):(2*(tan(x/2)A2-l)A2)/(tan(x/2)A2+1)A2-(4*tan(x/2)A2)/(tan(x/2)A2+1)A2mwcos2sin:2-3*sin(x)A2collect(x):2*cos(x)A2-sin(x)A2ans=2-3*sin(x)A22 sym

23、s x y s=sin(x)*cos(y)-cos(x)*sin(y);simple(s)simplify:sin(x-y)radsimp:cos(y)*sin(x)-cos(x)*sin(y)simplify(lOO):sin(x-y)combine(sincos):sin(x-y)combine(sinhcosh):cos(y)*sin(x)-cos(x)*sin(y)combine(ln):cos(y)*sin(x)-cos(x)*sin(y)factor:-(cos(x)*sin(y)-cos(y)*sin(x)expand:cos(y)*sin(x)-cos(x)*sin(y)com

24、bine:cos(y)*sin(x)-cos(x)*sin(y)rewrite(exp):(exp(-x*i)/2+exp(x*i)/2)*(exp(-y*i)*i)/2-(exp(y*i)*i)/2)+(exp(-x*i)*i)/2(exp(x*i)*i)/2)*(exp(-y*i)/2+exp(y*i)/2)rewrite(sincos):cos(y)*sin(x)-cos(x)*sin(y)rewrite(sinhcosh):cosh(x*i)*sinh(y*i)*i-cosh(y*i)*sinh(x*i)*irewrite(tan):(2*tan(y/2)*(tan(x/2)A2-l)

25、/(tan(x/2)A2+l)*(tan(y/2)A2+1)-(2*tan(x/2)*(tan(y/2)A2-l)/(tan(x/2)A2+l)*(tan(y/2)A2+1)mwcos2sin:sin(y)*(2*sin(x/2)A2-1)-sin(x)*(2*sin(y/2)A2-1)collect(x):cos(y)*sin(x)-cos(x)*sin(y)ans=sin(x-y)3 syms a b s=sqrt(a+sqrt(aA2-b)/2)+sqrt(a-sqrt(aA2-b)/2);simple(s)simplify:2A(l/2)*(a+(aA2-b)A(l/2)A(l/2)/

26、2+(a-(aA2-b)A(l/2)A(l/2)/2)radsimp:(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)simplify(lOO):(2A(l/2)*(a+(aA2-b)A(l/2)A(l/2)+(a-(aA2-b)A(l/2)A(l/2)/2combine(sincos):(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)combine(sinhcosh):(a/2-(a八2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(

27、l/2)combine(ln):(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)factor:(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)expand:(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)combine:(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)rewrite(exp):(a/2-(aA2-b)A(l/2)/2)A(l/2)+(

28、a/2+(aA2-b)A(l/2)/2)A(l/2)rewrite(sincos):(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)rewrite(sinhcosh):(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)rewrite(tan):(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)mwcos2sin:(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l

29、/2)collect(b):(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)ans=(a/2-(aA2-b)A(l/2)/2)A(l/2)+(a/2+(aA2-b)A(l/2)/2)A(l/2)4 syms x s=(4*xA2+8*x+3)/(2*x+l);simple(s)simplify:2*x+3radsimp:(4*xA2+8*x+3)/(2*x+1)simplify(lOO):2*x+3combine(sincos):(4*xA2+8*x+3)/(2*x+1)combine(sinhcosh):(4*xA2+8*x+3)

30、/(2*x+1)combine(ln):(4*xA2+8*x+3)/(2*x+1)factor:2*x+3expand:(8*x)/(2*x+1)+3/(2*x+1)+(4*xA2)/(2*x+1)combine:(4*xA2+8*x+3)/(2*x+1)rewrite(exp):(4*xA2+8*x+3)/(2*x+1)rewrite(sincos):(4*xA2+8*x+3)/(2*x+1)rewrite(sinhcosh):(4*xA2+8*x+3)/(2*x+1)rewrite(tan):(4*xA2+8*x+3)/(2*x+1)mwcos2sin:(4*xA2+8*x+3)/(2*x

31、+1)collect(x):2*x+3ans=2*x+33 求函数极限1 syms x f=abs(x)/x;limit(f,x,O/left)ans=2 syms x a f=(x+a/x)Ax;limit(f,x,inf,left*)ans=Inf4 求函数的符号导数 f=sqrt(x+sqrt(x+sqrt(x);diff(f)ans=(l/(2*xA(l/2)+l)/(2*(x+xA(l/2)A(l/2)+l)/(2*(x+(x+xA(l/2)A(l/2)A(l/2)diff(f,2)an s =-(l/(2*xA(l/2)+l)/(2*(x +xA(l/2)A(l/2)+l)A2/(

32、4*(x +(x +xA(l/2)A(l/2)A(3/2)-(l/(8*xA(3/2)*(x +xA(l/2)A(l/2)+(l/(2*xA(l/2)+l)A2/(4*(x +xA(l/2)A(3/2)/(2*(x +(x +x N l/2)八(U 2)八(1/2)2 s y ms x y z f=x+y-s qr t(xA2+yA2);dif f(f;x*)an s =1 -x/(xA2+yA2)A(l/2)dif f(f,y)an s =1-y/(xA2+yA2)A(l/2)5求不定积分1 x=s y m(,x,);f=l/s in(x);in t(f,x)an s =lo g(t an(

33、x/2)2 x=s y m(,x,);f=1 /(ac o s(x)A2*s qr t(I -xA2);in t(f,x)an s =l/ac o s(x)6用数值和符号法求定积分并比较1 x=s y m(*x*);in t(l Z(s qr t(x)+1 ),x,0,4)an s =4-lo g7求级数和1 s y ms n ;s=s y ms u m(l/4An,l,in f)s=1/32 s=symsum(sqrt(n+l)/n),l,inf)sum(n+l)/n)A(l/2),n=l.Inf)8 求泰勒展开式1 syms x;fl=tan(x);taylor(fl,x,3,2)ans=

34、tan(2)+(tan(2)+tan(2)A3)*(x-2)A2+(tan(2)A2+l)*(x-2)2 syms x;fl=(sin(x)A2;taylor(fl,x,5,0)ans=-xA4/3+xA29 求非线性方程符号解1 syms x y z a;x=sol ve(*log(x+1 )-5/(1 +sin(x)=2x)x=521.679263899058399794373666492582 syms x y z a;x y z=solve(,4*xA2/(4*xA2+1 )=y74*yA2/(4*yA2+1 )=z,4*zA2/(4*zA2+1 )=x,x,y,z,)Warning:

35、The solutions are parametrized by the symbols:z=RootOf(zlA6+(25*zl 八 5)/89+(31*z 1 八 4)/356+(3*zlA3)/178+(7*zlA2)/I424+zl/1424+1/5696,zl)minus(-1/2*1,1/2*1 union RootOf(zlA5+(114*zl八 4)/89+(487*zl八 3)/356+(493*zl八 2)/356+(1979*z 1)/1424+495/356,z 1)union RootOf(z 1 八 5+(215331*z 1 八 4)/329656+(ll*zl

36、A3)/178+(1043尹zl八 2)/659312+(2087*z 1)/659312+34487/5274496,zl)In solve at 180 x=01/2-20.0*zA5-21.617977528089887640449438202247*zA4-1.2359550561797752808988764044944*zA3+3.6741573033707865168539325842697*zA2-0.058988764044943820224719101123596*z-0.011235955056179775280898876404494y=1/2156.0*zA5+110

37、.82022471910112359550561797753*zA4+10.404494382022471910112359550562*zA3+2.5337078651685393258426966292135*zA2+0.30056179775280898876404494382022*z+0.097612359550561797752808988764045z=01/2Z10求阶微分方程组特解 x y=dsolve(,Dx=3*x+4*y,Dy=5*x-7*y,;x(0)=0;y(0)=0,t)x=y=第九章i,figureCColorJIAOJ/WindowButtonDownFcnV

38、textCO.S,0.5,Left Button Pressed,),);axis off2,默认属性 x=linspace(0,600,100000);y=(log(x+sqrt(1 +x.*x)/2;line(x,y)句柄操作 x=linspace(0,600,100000);y=(log(x+sqrt(l+x.*x)/2;line(x,y,linewidth,3,linestyieV-.VcolorVr);text(300,3.5;文字标注)(2)默认属性t=linspace(0,20,500);x=t.*t;y=5.*t.*t;line(x,y)句柄操作t=linspace(0,20,

39、500);x=t.*t;y=5.*t.*t;line(x,y);line(x,y,linewidth,3,linestyle,-.Vcolorr,);text(250,l 600,文字标注)3,(1)x=linspace(0,50,1000);x,y=meshgrid(x);z=x.*x+y.*y-5.*sin(x.*y);axes(view,-37.5,30);surf(x,y,z);lightCposition;10,20,4000);shading interp x=linspace(0,50J000);x,y=meshgrid(x);z=y.*y.*y;axesfview,-37.5,

40、30);surf(x,y,z);light(rposition,30,20,l 300000);shading interp4,x=-2*pi:0.01:2*pi;yl=sin(x);y2=cos(x);axes(position,0.1,0.6,0.2,0.21);plot(x,yl);axes(position,0.6,0.6,0.2,0.2D;plot(x,y2);axesfpositionJO.1,0.1,0.2,0.2);fplotCtan(x),-1.5,1.5);axesfpositionJO.1,0.2,0.2);fplot(cot(x),l0.1,3J)5,t=linspac

41、e(0,2*pi,6);k=t(l:length(t)-l);patch(sin(k),cos(k),1 :length(k)/facecolor/interp);colonnap summer;axis equal;思考练习3,(1)默认属性 x=linspace(0,50,1000);y=(l+x.A2)/(l+x.A4);line(x,y)句柄属性 x=linspace(0,50,1000);y=(l+x.A2)/(l+x.A4);line(x,y,linewidth,3,linestyle,-.Vcolorb,);text(25,l,文字标注)(2)默认属性 x=linspace(0,

42、800,5000);y=3.:cx+sin(x)-exp(x);axes(XLim,0,7,YLim,-10,5);line(x,y)句柄属性 x=linspace(0,800,5000);y=3.*x+sin(x)-exp(x);axes(XLim;0J;YLim;-10,5);line(x,y;linewidth,3;linestyle,-.,color,;c);text(3,3;文字标注)4,(1)t=linspace(0,2*pi,100);x=cos(t);y=sin(t);z=t;axes(view,-37.5,30);plot3(x,y,z);grid x=linspace(0,

43、3,100);x,y=meshgrid(x);z=x.*y.*exp(-.*x.*x-y.*y);axes(,view,-37.5,30);surf(x,y,z);lightOsitionJO.1,0.1,0.5);shading interp5,x,y,z=cylinder(0.5,30);surf(x,y,z);axis equal;light(positionJ-0.5,-0.4,01);shading interp第十章1,screen=get(0,ScreenSize);W=screen(3);H=screen(4);hf=figure(Color;1,1,1/Position;1,

44、1 设 计 菜 单,NumberTitle,ofF,MenuBar,none,);hfile=uimenu(hf,label,AFile1);hhelp=uimenu(hf,label,/&Help,);uimenu(hfile,label,New,call,dispCNew Item,),);uimenu(hfile,label,Open,call,dispCOpen Item1);hsave=uimenu(hfile,label1,(feSaveEnableVoff);uimenu(hsave,label*,(feSave/call/dispCSave Item)1);uimenu(hfi

45、le,label,r&Exit,separator,on,call,close(hf),);uimenu(hhelp,label1,About.VcallJdispCHelp Item);?set(hsave,EnableJon);2,screen=get(0,ScreenSize,);W=screen(3);H=screen(4);figure(Color,1,1,1,Position,0.2*H,0.2*H,0.5*W,0.3*H,Name?正 弦 曲 线/NumberTitle/off/MenuBarVnone);t=-pi:pi/20:pi;y=sin(t);h=plot(t,y);h

46、color=uimenu(gcf,Label?&Color);uimenu(hcolor,Label1,Red1,all/setCh,Color,r),);uimenu(hcolor,Label,Blue,Can,set(h,“Color,b);uimenu(hcolor,Label1,Green,Call,setCh/ColorVg),);3,(1)hp=uicontrol(gcf,tyle1,popup1,String1,sin(x)lcos(x),Position,100,100,100,80);(2)sm=uicontrol(style?text,position,200,300,10

47、0,40,string;前三个是系数,按下解求根);ecicontroKStyleVedit,position,200,200,40,40);yc=uicontrol(,Style,;edit,;position,300,200,40,40);IcicontrolCtyle,edit,position1,400,200,40,40);genicontroUtyleVtext1,position,500,200,40,40);M=,a=str2num(get(ec,string,);,b=str2num(get(yc,string,);7c=str2num(get(lc,string,);7A=

48、a,b,c;,/dec=roots(A);,set(gen,string,dec)1;jieicontrolCtyle*,push7string,*?,position1,350J 50,40,30,call,M);4,倾斜的 callback函数为:set(handles.text1*FontAngle,*italic 1);if get(handles.checkboxlz Value)=0;set(handles.text1,1FontAngle,*normal*);end 粗体 的 callback函数为:set(handles.textlAFontweight,bold1);if g

49、et(handles.checkbox2z*Value)=0;set(handles.textl,*Fontweightz normal1);end 字体大 小 的 callback函数为:set(handles.text1z 1 Fontsize*,str2num(get(handles.edit1z*String 1);红 的 callback函数为:if get(handles.radiobuttonlz f Value,)=1;set(handles.textlzForegroundcolor*,*r1)set(handles.radiobutton2r Value,0);set(ha

50、ndles.radiobutton3z Value,0);end 黄 的 callback函数为:if get(handles.radiobutton2,*Value,)=1;set(handles.textlf*Foregroundcolor1f1y f)set(handles.radiobuttonlf 1 Value,0);set(handles.radiobutton3z Valuez 0);end 蓝 的 callback函数为:if get(handles.radiobutton3,f Value,)=1;set(handles.text1,1 Foregroundcolor1r

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

当前位置:首页 > 教育专区 > 教案示例

本站为文档C TO C交易模式,本站只提供存储空间、用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。本站仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知淘文阁网,我们立即给予删除!客服QQ:136780468 微信:18945177775 电话:18904686070

工信部备案号:黑ICP备15003705号© 2020-2023 www.taowenge.com 淘文阁