MATLAB仿真实验报告

合集下载
  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

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 :

●Creating multi-dimensional arrays 创建多维数组

●Finding the dimensions寻找尺寸

●Accessing elements 访问元素

●Manipulating multi-dimensional arrays操纵多维数组

●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的维度

end

ans =

10.3589

-1.0000

1.6411

ans =

21.2293

0.3854 + 1.5778i

0.3854 - 1.5778i

ans =

相关文档
最新文档