资源描述:
《matlab程序设计与应用 -2new》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、MATLAB程序设计与应用作业09数控本一班万荟20090705104MATLAB程序设计与应用作业例(exno17t.m):symsxabcf=sym('a*x^2+b*x+c')%f=a*x^2+b*x+cfindsym(f,4)%ans=x,c,b,ay(1)=limit(f,x,1);y(2)=limit(f,1);y(3)=limit(f,a,2);y(4)=limit(f,b,1);y%y=[a+b+c,a+b+c,2*x^2+b*x+c,a*x^2+x+c]例(exno18t.m):symsxf=sym('ln(1+2*x)/sin(3*x)')%f=ln(1
2、+2*x)/sin(3*x)findsym(f)%ans=xa=limit(f,x,1)%a=log(3)/sin(3)b=limit(f,1)%b=log(3)/sin(3)c=limit(f,x,0)%c=2/3d=limit(f,0)%d=2/3MATLAB程序设计与应用作业例(exno19t.m):symsxf=sym('x/(cos(x))^2')findsym(f)y(1)=diff(f)y(2)=int(f,0,1)y(3)=int(f)y例(exno18tt.m):x=[132;631;312][ex,ey]=gradient(x,0.5,0.2)例:MAT
3、LAB程序设计与应用作业(exno20t.m)[x,y]=meshgrid(-2:0.5:2,-2:0.5:2)t=x.*exp(-x.^2-y.^2)[px,py]=gradient(t,0.05,0.05)td=sqrt(px.^2+py.^2)subplot(221)imagesc(t)subplot(222)imagesc(td)colormap('gray')例(exno21t.m):MATLAB程序设计与应用作业symsx1x2aeq1=sym('x1^2+x2=a')eq2=sym('x1-a*x2=0')[x1x2]=solve(eq1,eq2,x1,x2)
4、v=solve(eq1,eq2)v.x1v.x2an1=x1(1),an2=x2(2)an3=x2(1),an4=x2(2)例(exno22t.m):[y]=dsolve('Dy=-a*y','y(0)=1','x')s=dsolve('Dy=-a*y','y(0)=1','x')MATLAB程序设计与应用作业例(exno23t.m):[u,w]=dsolve('Du=-a*w,Dw=sin(z)','u(0)=1,w(0)=0','z')v=dsolve('Du=-a*w,Dw=sin(z)','u(0)=1,w(0)=0','z')%u=a*sin(z)-a*z+1%w
5、=-cos(z)+1v.uv.w%v=u:[1x1sym]w:[1x1sym]%ans=a*sin(z)-a*z+1%ans=-cos(z)+1MATLAB程序设计与应用作业例(exno13.m):求下列函数的根A=[21-51;1-30-6;02-12;14-76]B=[8;9;-5;0]x=AB%x=3.0000-4.0000-1.00001.0000