《MATLAB仿真及电子信息应用答案(最新整理)》由会员分享,可在线阅读,更多相关《MATLAB仿真及电子信息应用答案(最新整理)(8页珍藏版)》请在金锄头文库上搜索。
1、.MATLAB 仿真及电子信息应用第二单元1. a=zeros(2) a =0000 a(1,2)=2a =02002. a=10-23;b=012 1; a+b ans =1104 a.*b ans =00-43/-4+3 =-1 dot(a,b) ans =-13. a=randn(4)a =0.81561.1908-1.6041-0.80510.7119-1.20250.25730.52871.2902-0.0198-1.05650.21930.6686-0.15671.4151-0.9219 sum(diag(a)word 范文ans =-2.3652 reshape(a,2,8) a
2、ns =0.81561.29021.1908-0.0198-1.6041-1.0565-0.80510.21930.71190.6686-1.2025-0.15670.25731.41510.5287-0.92194. a=rand(3,5)a =0.95010.48600.45650.44470.92180.23110.89130.01850.61540.73820.60680.76210.82140.79190.1763 a(:,4)=a(:,4)+0.2a =0.95010.48600.45650.64470.92180.23110.89130.01850.81540.73820.606
3、80.76210.82140.99190.1763lt(a,0.5)ans =0110010100000015. a=randn(3,2);b=randn(3,2); cat(1,a,b)/按列方向ans =0.73100.67710.57790.56890.0403-0.2556-0.3775-0.2340-0.29590.1184-1.47510.3148 cat(2,a,b)/按行方向ans =0.73100.6771-0.3775-0.23400.57790.5689-0.29590.11840.0403-0.2556-1.47510.31486. Helloeveryoneans =
4、Hello everyone7. str1=MATLAB ;str2 =is strong;str3=str1,str2 str3 =MATLAB is strong 8.(1)直接法 a=Function Variable;y=f(x) x;6 1:5 a =FunctionVariable y=f(x)x61x5 double (2)函数法 a=cell(3,2);a1,1=Function;a1,2=Variable; a2,1=y=f(x);a2,2=x; a3,1=6;a3,2=1:5; aa =FunctionVariable y=f(x)x61x5 double9.student
5、1.Name=Mary;student1.Age=Eighteen;student1.Score=502;student1.Class=1;student1 student1 =Name: Mary Age: EighteenScore: 502Class: 1 student2.Name=Mike;student2.Age=Nighteen; student2.Score=498;student2.Class=2; student2 student2 =Name: Mike Age: NighteenScore: 498Class: 2 student3.Name=Joe;student3.
6、Age=Eighteen; student3.Score=520;student3.Class=3;student3 student3 =Name: JoeAge: Eighteen Score: 520Class: 3第三单元3-1clear all clcp=5 4 1 2 1;roots(p)%求根y=polyval(p,5)%求在 5 处函数的函数值3-2clear all clcp=2 0 -2 5;x=1 2 4;-1 0 3;5 2 1;f=polyder(p)%多项式求导polyvalm(p,x)3-3clear all clcf=factor(sym(2*x4-5*x3+4*
7、x2-5*x+2) 3-4clear allclcf1=sym(x2+1)(x-2); f2=sym(2*x2+1); f=expand(f1*f2)3-5clear all clcsyms x y;f=log(1+x);g=2*sin(y);compose(f,g)compose(g,f) 3-6clear all clcsyms x ;finverse(cos(1+x) 3-7(1)(2)clear all clcsyms x y k;f1=(1/2x)+(-1)x/x2);f2=1/(1+k2) 1/(2*k+1)s1=symsum(f1,1,inf)s2=symsum(f2,1,inf
8、)(3)(4)(5)(6) clear all clcsyms x ; f1=(1+2x)(1/x); f2=(x2)*exp(1/x2); f3=log(tan(x)/sin(x);f4=(x/(2*x+1)(x-1); limit(f1,inf) limit(f2,0) limit(f3,x,0,right) limit(f4,inf)(7)(8)clear all clcsyms x y z a b; f1=1/(1+x2); f2=(x2+y2+z2);int(f1,x,a,b) int(int(int(f2,z,sqrt(x*y),x*y),y,sqrt(x),x),x,0,1) 3
9、-8clear all clcsyms x;f=x*exp(x) log(sin(x);1/(1+x2) x(3/2); diff(f,2)3-9(1) clear all clcf=sym(x3-2*x+5);solve(f)(2) clear all clcsyms x1 x2 x3;f1=2*x1-5*x2+3; f2=5*x1-2*x2+18;x1 x2=solve(f1,f2)(3)方法一: clear all clcsyms x1 x2 x3;f1=3*x1+11*x2-2*x3-8; f2=1*x1+1*x2-2*x3+4; f3=x1-x2+x3-3;x1 x2 x3=solv
10、e(f1,f2,f3)方法二: clear all clcA=3 11 -2;1 1 -2;1 -1 1;B=8;-4;3;x=AB(4) clear all clcsyms x1 x2 x3;f1=2*x1-x2-exp(-x1); f2=x1-2*x2-exp(-x2); x1 x2=solve(f1,f2) 3-10clear all clcdsolve(D2y+2*Dy+2*y=0,y(0)=0,Dy(0)=1) 3-11clear all clcx y=dsolve(Dx=y,Dy=(-1)*x,x(0)=1,y(0)=2)“”“”At the end, Xiao Bian give
11、s you a passage. Minand once said, people who learn to learn are very happy people. In every wonderful life, learning is an eternal theme. As a professional clerical and teaching position, I understand the importance of continuous learning, life is diligent, nothing can be gained, only continuous le
12、arning can achieve better self. Only by constantly learning and mastering the latest relevant knowledge, can employees from all walks of life keep up with the pace of enterprise development and innovate to meet the needs of the market. This document is also edited by my studio professionals, there may be errors in the document, if there are errors, please correct, thank you!