




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、.MATLAB仿真及电子信息应用第二单元1. >> a=zeros(2)a = 0 0 0 0>> a(1,2)=2a = 0 2 0 02. >> a=1 0 -2 3;b=0 1 2 1;>> a+bans = 1 1 0 4>> a.*bans = 0 0 -4 3 /-4+3 =-1>> dot(a,b)ans =-13. >> a=randn(4)a = 0.8156 1.1908 -1.6041 -0.8051 0.7119 -1.2025 0.2573 0.5287 1.2902 -0.0198
2、-1.0565 0.21930.6686 -0.1567 1.4151 -0.9219>> sum(diag(a)ans = -2.3652>> reshape(a,2,8)ans = 0.8156 1.2902 1.1908 -0.0198 -1.6041 -1.0565 -0.8051 0.21930.7119 0.6686 -1.2025 -0.1567 0.2573 1.4151 0.5287 -0.92194. >> a=rand(3,5)a = 0.9501 0.4860 0.4565 0.4447 0.9218 0.2311 0.8913 0.
3、0185 0.6154 0.73820.6068 0.7621 0.8214 0.7919 0.1763>> a(:,4)=a(:,4)+0.2a = 0.9501 0.4860 0.4565 0.6447 0.9218 0.2311 0.8913 0.0185 0.8154 0.73820.6068 0.7621 0.8214 0.9919 0.1763>> lt(a,0.5)ans = 0 1 1 0 0 1 0 1 0 0 0 0 0 0 15. >> a=randn(3,2);b=randn(3,2);>> cat(1,a,b) /按列方
4、向ans = 0.7310 0.6771 0.5779 0.5689 0.0403 -0.2556 -0.3775 -0.2340 -0.2959 0.1184 -1.4751 0.3148>> cat(2,a,b) /按行方向ans = 0.7310 0.6771 -0.3775 -0.2340 0.5779 0.5689 -0.2959 0.11840.0403 -0.2556 -1.4751 0.31486. >> 'Hello everyone'ans =Hello everyone7. >> str1='MATLAB
5、9;str2 ='is strong'str3=str1,str2str3 =MATLAB is strong8.(1)直接法>> a='Function' 'Variable''y=f(x)' 'x''6' 1:5a = 'Function' 'Variable' 'y=f(x)' 'x' '6' 1x5 double(2)函数法>> a=cell(3,2);a1,1='Function
6、'a1,2='Variable'>> a2,1='y=f(x)'a2,2='x'>> a3,1='6'a3,2=1:5;>> aa = 'Function' 'Variable' 'y=f(x)' 'x' '6' 1x5 double9. >>student1.Name='Mary'student1.Age='Eighteen'>>student1.Sc
7、ore='502'student1.Class='1'student1student1 = Name: 'Mary' Age: 'Eighteen' Score: '502'Class: '1'>> student2.Name='Mike'student2.Age='Nighteen'>> student2.Score='498'student2.Class='2' student2student2 = Name
8、: 'Mike' Age: 'Nighteen' Score: '498'Class: '2'>> student3.Name='Joe'student3.Age='Eighteen'>> student3.Score='520'student3.Class='3'student3student3 = Name: 'Joe' Age: 'Eighteen' Score: '520' Class:
9、'3'第三单元3-1clear allclcp=5 4 1 2 1;roots(p) %求根y=polyval(p,5) %求在5处函数的函数值3-2clear allclcp=2 0 -2 5;x=1 2 4;-1 0 3;5 2 1;f=polyder(p) %多项式求导polyvalm(p,x)3-3clear allclcf=factor(sym('2*x4-5*x3+4*x2-5*x+2')3-4clear allclcf1=sym('(x2+1)(x-2)');f2=sym('2*x2+1');f=expand(f1*
10、f2)3-5clear allclc>>syms x y;>>f=log(1+x);>>g=2*sin(y);>>compose(f,g)>>compose(g,f)3-6clear allclc>>syms x ;>>finverse(cos(1+x)3-7(1)(2)clear allclc>>syms x y k;>>f1=(1/2x)+(-1)x/x2);>>f2=1/(1+k2) 1/(2*k+1)>>s1=symsum(f1,1,inf)>>
11、;s2=symsum(f2,1,inf)(3)(4)(5)(6)>> clear allclcsyms 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 allclcsyms 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
12、*y),y,sqrt(x),x),x,0,1)3-8clear allclcsyms x;f=x*exp(x) log(sin(x);1/(1+x2) x(3/2);diff(f,2)3-9(1)clear allclcf=sym('x3-2*x+5');solve(f)(2)clear allclcsyms x1 x2 x3;f1=2*x1-5*x2+3;f2=5*x1-2*x2+18;x1 x2=solve(f1,f2)(3)方法一:clear allclcsyms 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=solve(f1,f2,f3)方法二:clear allclcA=3 11 -2;1 1 -2;1 -1 1;B=8;-4;3;x=AB(4)clear allclcsyms x1 x2 x3;f1=2*x1-x2-exp(-x1);f2
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 入职安全培训模板下载课件
- 我和班有个约定+课件-2025-2026学年高一上学期开学第一课主题班会
- 健康瑜伽专业知识培训课件
- 供热基础知识培训内容课件
- 琼山中学2025-2026学年物理高三上期末达标检测模拟试题
- 2024-2025学年广东省广州七中高一(上)期中语文试卷
- 涉税从业人员管理办法
- 电网基建现场管理办法
- 綦江人才引进管理办法
- 管理助学资金管理办法
- 辽宁省名校联盟2025年高三9月份联合考试 生物试卷(含答案解析)
- (2025秋新修订)人教版三年级数学上册全册教案(教学设计)
- 新版人教版二年级上册数学全册1-6单元教材分析
- 2025年国家心力衰竭诊断和治疗指南
- 2024-2025学年北京市海淀区三年级(下)期末数学试卷
- 孕期产检的课件
- 奶茶设备知识培训课件
- 食品添加剂与调味品生产工艺作业指导书
- 大型展会现场安全保障工作方案
- 2025至2030年中国食用植物油市场竞争策略及行业投资潜力预测报告
- 2025年国家电网中级职称考试(档案专业)历年参考题库含答案详解(5卷)
评论
0/150
提交评论