




已阅读5页,还剩4页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
实验三实验三 MATLAB 数值运算数值运算 实验者 祝松 年级 机设 092 学号 09405701002 一 实验目的 掌握 MATLAB 的 数 值 运 算 及 其 运 算 中 所 用 到 的 函 数 掌 握 结 构 数 组 和 细 胞 数 组 的操作 二 实验内容 1 多项式运算 2 多项式插值和拟合 3 数值微积分 4 结构数组和细胞数组 三 实验步骤 1 多项式运算 1 多项式表示 在 MATLAB 中 多项式表示成向量的形式 如 在 MATLAB 中表示为934 ss S 1 3 5 0 9 2 多项式的加减法相当于向量的加减法 但须注意阶次要相同 如不同 低阶的要补 0 如多项式 2 s 2 3 s 9 与多项式 s 4 3 s 3 5 s 2 4 s 7 相加 S1 0 0 2 3 11 S2 1 3 5 4 7 S3 S1 S2 3 多项式的乘 除法分别用函数 conv 和 deconv 实现 S1 2 3 11 S2 1 3 5 4 7 S3 conv S1 S2 S4 deconv S3 S1 4 多项式求根用函数 roots S1 2 4 2 roots S1 5 多项式求值用函数 polyval S1 2 4 1 3 polyval S1 3 计算 x 3 时多项式的值 x 1 10 y ployval S1 x 计算 x 向量对应的值得到 y 向量 练习 求 s 2 1 s 3 s 1 s 3 2s 1 的 商 及 余 多项式 2 结构数组与细胞数组 1 结构数组的创建 student number 20050731001 student name Jack student 2 number 20050731002 student 2 name Lucy 或者用 struct 函数创建 student struct number 001 002 name Jack Lucy 2 结构数组的操作 student 1 subject 添加 subject 域并赋予空值 student 1 sorce student fieldnames student getfield student 2 name student rmfield student subject 删除 subject 域 student setfield student 1 sorce 90 student 2 sorce 88 比较和上一条语句是否效果一样 练习 创建一结构数组 stusorce 其域为 学号 姓名 英语成绩 数学成绩 语文成 绩 总分 平均分 结构数组的大小为 2 2 3 细胞数组的创建 A How are you ones 3 1 2 3 4 cell 直接创建 B 1 1 Hello world 由各个细胞元素创建 B 1 2 magic 3 B 2 1 1 2 3 4 或者用 cell 函数先创建空的细胞数组 然后再给各个元素赋值 C cell 1 2 创建 1 2 的细胞数组 C 1 1 Hello world C 1 2 magic 3 C 1 3 1 2 3 4 4 细胞数组的操作 ans1 A 1 1 ans2 A 1 1 注意圆括号和花括号的区别 ans1 和 ans2 的数据类型 whos ans1 ans2 celldisp A 显示细胞数组的所有元素 a1 A 2 1 1 2 取出 A 的第 2 行第 1 列细胞元素的矩阵第 1 行第 2 列内容 a2 a3 deal A 1 2 取出 A 的第 1 和第 2 个细胞元素的内容赋给 a2 a3 练习 创建一大小为 2 2 细胞数组 stucell 其元素的类型分别为 结构类型 字符 串 矩阵和细胞类型 四 实验结果 S1 0 0 2 3 11 S1 0 0 2 3 11 S2 1 3 5 4 7 S2 1 3 5 4 7 S3 S1 S2 S3 1 3 3 7 18 S1 2 3 11 S1 2 3 11 S2 conv S1 S2 S2 2 9 10 26 29 65 77 S4 deconv S3 S1 S4 0 5000 0 7500 5 3750 S1 2 4 2 S1 2 4 2 ROOTS S1 Warning Function call ROOTS invokes inexact match C MATLAB7 toolbox matlab polyfun roots m ans 1 1 S1 2 4 1 3 S1 2 4 1 3 polyval S1 3 ans 90 x 1 10 x 1 2 3 4 5 6 7 8 9 10 y polyval S1 x y Columns 1 through 9 4 31 90 193 352 579 886 1285 1788 Column 10 2407 p1 conv 1 0 1 conv 1 2 1 1 p1 1 3 3 3 2 p2 1 0 1 1 p2 1 0 1 1 q r deconv p1 p2 q 1 3 r 0 0 2 1 1 student 1 subject student 1x2 struct array with fields number name subject student 1 corce student 1x2 struct array with fields number name subject corce student student 1x2 struct array with fields number name subject corce fieldnames student ans number name subject corce getfield student 2 name ans Lucy student rmfield student name student 1x2 struct array with fields number subject corce student setfield student 1 sorce 90 student 1x2 struct array with fields number subject corce sorce student 2 sorce 88 student 1x2 struct array with fields number subject corce sorce A How are you ones 3 1 2 3 4 cell A How are you 3x3 double 2x2 double 1x1 cell B 1 1 Hello world B Hello world B 1 2 magic 3 B Hello world 3x3 double B 2 1 1 2 3 4 B Hello world 3x3 double 1x4 double B 2 2 123 B Hello world 3x3 double 1x4 double 123 C cell 1 2 C C 1 1 Hello world C Hello world C 1 2 magic 3 C Hello world 3x3 double C 1 3 1 2 3 4 C Hello world 3x3 double 1x4 double ans1 A 1 1 ans1 How are you ans2 A 1 1 ans2 How are you whos ans1 ans2 Name Size Bytes Class ans1 1x1 84 cell array ans2 1x1 84 cell array Grand total i
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 2025甘肃平凉市集善乐业残健融合数字化就业培训中心招聘考前自测高频考点模拟试题及参考答案详解1套
- 2025湖北十堰市城市发展控股集团有限公司及所属子公司招聘拟聘用人员模拟试卷及答案详解(名校卷)
- 2025年宿州市立医院招聘42人模拟试卷及答案详解一套
- 2025年上半年内江市部分学校公开考试招聘教师、部分事业单位公开考试招聘工作人员笔试考前自测高频考点模拟试题及一套答案详解
- 2025届春季河南新乡市卫龙校园招聘考前自测高频考点模拟试题及完整答案详解一套
- 2025辽宁鞍山市事业单位招聘大学生退役士兵50人模拟试卷附答案详解(突破训练)
- 2025湖南岳阳临湘市城东粮食收储有限公司招聘模拟试卷含答案详解
- 2025贵州铜仁市生态环境局所属事业单位引进高人才11人模拟试卷及答案详解(各地真题)
- 2025年黑河逊克县乡村医生公开招聘19人考前自测高频考点模拟试题及完整答案详解1套
- 2025广东东莞东坑镇松实东中招聘镇聘教师27人考前自测高频考点模拟试题及完整答案详解
- 2025年合肥市社会化工会工作者招聘34人笔试备考试题及答案解析
- 非婚生子女法律抚养权协议范本
- 2025年新版中层副职面试题及答案
- 蜂窝组织炎护理小讲课
- 智慧树知道网课《工业机器人技术基础》课后章节测试满分答案
- (一检)泉州市2026届高三高中毕业班质量监测(一)数学试卷(含标准答案)
- 纤维转盘滤布滤池运行维护技术说明
- 2025至2030中国无烟产品行业发展趋势分析与未来投资战略咨询研究报告
- 2021年全球工作场所状况报告 State of the Global Workplace 2021 Report
- 球墨铸铁管-施工方案(3篇)
- (正式版)DB35∕T 2242-2025 《户用光伏发电系统安装技术规范》
评论
0/150
提交评论