




已阅读5页,还剩2页未读, 继续免费阅读
版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
MATLAB 仿真实验报告课题名称:MATLAB 仿真图像处理学 院:机电与信息工程学院专 业:电子信息科学与技术年级班级:2012级电子二班一、实验目的1、掌握MATLAB处理图像的相关操作,熟悉相关的函数以及基本的MATLAB语句。2、掌握对多维图像处理的相关技能,理解多维图像的相关性质3、熟悉Help 命令的使用,掌握对相关函数的查找,了解Demos下的MATLAB自带的原函数文件。4、熟练掌握部分绘图函数的应用,能够处理多维图像。二、实验条件MATLAB调试环境以及相关图像处理的基本MATLAB语句,会使用Help命令进行相关函数查找三、实验内容1、nddemo.m函数文件的相关介绍 Manipulating Multidimensional Arrays MATLAB supports arrays with more than two dimensions. Multidimensional arrays can be numeric, character, cell, or structure arrays. Multidimensional arrays can be used to represent multivariate data. MATLAB provides a number of functions that directly support multidimensional arrays. Contents :l Creating multi-dimensional arrays 创建多维数组l Finding the dimensions寻找尺寸l Accessing elements 访问元素l Manipulating multi-dimensional arrays操纵多维数组l Selecting 2D matrices from multi-dimensional arrays从多维数组中选择二维矩阵 (1)、Creating multi-dimensional arrays Multidimensional arrays in MATLAB are created the same way as two-dimensional arrays. For example, first define the 3 by 3 matrix, and then add a third dimension. The CAT function is a useful tool for building multidimensional arrays. B = cat(DIM,A1,A2,.) builds a multidimensional array by concatenating( 联系起来 ) A1, A2 . along the dimension DIM. Calls to CAT can be nested(嵌套).(2)、Finding the dimensions SIZE and NDIMS return the size and number of dimensions of matrices.(3)、Accessing elements To access a single element of a multidimensional array, use integer subscripts(整数下标 ). (4)、Manipulating multi-dimensional arrays RESHAPE, PERMUTE, and SQUEEZE are used to manipulate n-dimensional arrays. RESHAPE behaves as it does for 2D arrays. The operation of PERMUTE is illustrated below. Let A be a 3 by 3 by 2 array. PERMUTE(A,2 1 3) returns an array with the row and column subscripts reversed (dimension 1 is the row, dimension 2 is the column, dimension 3 is the depth and so on). Similarly, PERMUTE(A,3,2,1) returns an array with the first and third subscripts interchanged. A = rand(3,3,2);B = permute(A, 2 1 3);%permute:(转置)C = permute(A, 3 2 1);(5) 、Selecting 2D matrices from multi-dimensional arrays Functions like EIG that operate on planes or 2D matrices do not accept multi-dimensional arrays as arguments. To apply such functions to different planes of the multidimensional arrays, use indexing or FOR loops. For example: A = cat( 3, 1 2 3; 9 8 7; 4 6 5, 0 3 2; 8 8 4; 5 3 5, . 6 4 7; 6 8 5; 5 4 3);% The EIG function is applied to each of the horizontal slices of A.for i = 1:3 eig(squeeze(A(i,:,:) %squeeze除去size为1的维度endans = 10.3589 -1.0000 1.6411ans = 21.2293 0.3854 + 1.5778i 0.3854 - 1.5778ians = 13.3706 -1.6853 + 0.4757i -1.6853 - 0.4757iINTERP3, INTERPN, and NDGRID are examples of interpolation and data gridding functions that operate specifically on multidimensional data. Here is an example of NDGRID applied to an N-dimensional matrix. 示例程序x1 = -2*pi:pi/10:0;x2 = 2*pi:pi/10:4*pi;x3 = 0:pi/10:2*pi;x1,x2,x3 = ndgrid(x1,x2,x3);z = x1 + exp(cos(2*x2.2) + sin(x3.3);slice(z,5 10 15, 10, 5 12); axis tight;程序运行结果:2、题目要求:编写程序,改变垂直于X轴的三个竖面的其中两个面的形状,绘制出图形。3、题目解答程序:clear all;close all;clc;x1 = -2*pi:pi/10:0; x2 = 2*pi:pi/10:4*pi; x3 = 0:pi/10:2*pi;x1,x2,x3 = ndgrid(x1,x2,x3);%生成绘制3-D图形所需的网格数据z = x1 + exp(cos(2*x2.2) + sin(x3.3);slice(z,10, 10, 5 12); %用slice画四维图像,颜色表示第四维的数值axis tight;%axis tight是使坐标系的最大值和最小值和上述的数据范围一致xsp,ysp,zsp = sphere;%绘制球体xsp=6*xsp;ysp=6*ysp;zsp=6*zsp;hsp = surface(xsp+0.8,ysp+10,zsp+11);xd = get(hsp,XData);yd = get(hsp,YData);zd = get(hsp,ZData);delete(hsp)%删除图形对象处理hsphold onhslicer = slice(z,xd,yd,zd);axis tight hold offhsp = surface(xsp+21.1,ysp+10,zsp+11);xd = get(hsp,XData);%获得X轴数据yd = get(hsp,YData);%获得Y轴数据zd = get(hsp,ZData);%获得Z轴数据delete(hsp)%删除图形对象处理hsphold onhslicer = slice(z,xd,yd,zd);axis tight view(5,2)%从通过方位角5度、俯视角2度的地方观看图像hold off所得图形:4、 实验思考 我们的题目主要是对多维图像进行处理,首先我们在Help命令下,查阅了nddemo.m函数的相关介绍,知道了怎样把两个二维矩阵相联系,形成三维矩阵,我们认真分析了nddemo.m函数文件的相关程序,查找了相关函数的使用方法小组成员也进行了细致的讨论,最终找到了解决问题的方法。以上只是我们的一种结题思路,我们还会继续努力,争取实现多种变换方式,例如把两个球面换成抛物面或是其他曲面。这次的实验我们的收获很大。五、小组总结这次小学期的Matlab实验具有一定的挑战难度,以前并没有做过类似的实验,不过我们小组三人相互配合,共同努力,最后还是比较好地完成了任务。由于我们的实验要把两个平面转换成曲面,我们就打算转换成球面比较方便。但是,以前没有学过相关的函数,所以我们上网找些资料,自学了”sphere”、“ndgrid”、“surface”、“delete”等函数的使用方法,利用”sphere”函数返回的值来生成我们想要的球面。但是事情总是没有那么简单的,在编写程序的过程中我们也遇到了种种的困难,比如球心坐标的计算错误,在运行程序时出现各种错误报告,有时还不经意地把中文字符当成了英文字符,
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 小儿推拿培训课程
- 广东省汕头市潮南区司马浦镇2026届化学九年级第一学期期中经典试题含解析
- 医院工会总结汇报
- 2026届湖南省长沙市雨花区英语九上期末检测试题含解析
- 大学部门工作总结
- 事业处工会年度工作总结
- 交警整治酒驾汇报
- 2026届四川省成都市龙泉驿区化学九上期中考试模拟试题含解析
- 2026届云南省昆明市五华区云南师范大附属中学九年级化学第一学期期中调研模拟试题含解析
- 重庆市实验外国语学校2025-2026学年高三上学期9月月考英语试题(含答案无听力原文及音频)
- T/CAPE 11005-2023光伏电站光伏组件清洗技术规范
- 2024江苏苏州市常熟农商银行网络金融部招聘4人笔试历年典型考题及考点剖析附带答案详解
- 钢结构主体验收评估报告
- 人教版历史与社会七下第八单元第三课《中华文明探源》教学设计
- 更换钢板施工方案
- 大学生职业规划大赛《机械电子工程专业》生涯发展展示
- 家政三方合同协议范本
- 预制双层不锈钢烟道及烟囱技术规程
- DB32T 5079-2025城镇供水水表安装及维护技术规程
- 行业法律法规解读
- 大学生就业心理调适与应对
评论
0/150
提交评论