1 CREATING A ONE-DIMENSIONAL ARRAY (VECTOR)
1.1 Creating a vector from a known list of numbers
例子
yr=[1984 1986 1988 1990 1992 1994 1996]
pop=[127; 130; 136; 145; 158; 178; 211]
Row vector
中间可以用space 或者用square brackets(,)号来隔开
Column vector
每一个Column要用semicolon或者用Enter换行隔开
1.2 Creating a vector with constant spacing
variable_name = [m:q:n] Or variable_name = m:q:n
first term is m,last term is n,and the spacing is q
如果加q之后不能达到n,选择离n最近的
If only the first and the last terms,then the default for the spacing is 1
1.3 Creating a vector with linear
variable_name = linspace(xi,xf,n)
xi is First element
xf is Last element
n is Number of elements
When the number of elements is omitted, the default is 100
表示从xi到xf的vector,一共n个数(包括xi,xf)
1.4 CREATING A TWO-DIMENSIONAL ARRAY
variable_name=[1st row elements; 2nd row elements; 3rd row elements; ... ; last row elements]
行之间的用space 或者用square brackets(,)号来隔开
列之间的用semicolon来隔开
create a matrix with m rows and n columns which all elements are the numbers 0
zeros(m,n)
create a matrix with m rows and n columns which all elements are the numbers 1
ones(m,n)
creates a square matrix with n rows and n columns in which the diagonal elements are equal to 1 and the rest of the elements are 0
eyes(n)
1.5 NOTES ABOUT VARIABLES IN MATLAB
在matlab中所有的变量都是数组,分别是scalar,vector and matrix
当变量被分配的时候,不需要分配其大小(before the elements are assigned)
scalar,vector and matrix这三种是可以随便再赋值的
1.6 The transpose operator
方法是X=Y‘
1.7 ARRAY ADDRESSING
1.7.1 Vector
VCT=[35 46 78 23 5 14 81 3 55];
VCT(4);
还可以这样给赋值va(m:n)
u=VCT(3:7)
还可以指定要那些,如
u=v([3, 5, 7:10])
1.7.2 Matrix
MAT=[3 11 6 5; 4 7 10 2; 13 9 0 8];
MAT(3,1)
还可以这样给赋值A(:,n),A(n,:),A(:,m:n),A(m:n,:),A(m:n,p:q)
A=[1 3 5 7 9 11;
2 4 6 8 10 12;
3 6 9 12 15 18;
4 8 12 16 20 24;
5 10 15 20 25 30]
B=A(:,3)
C=A(2,:)
E=A(2:4,:)
F=A(1:3,2:4)
还可以指定要那些,如
B = A([1,3],[1,3,5:7]) 1行,3行,1列,3列,5到7列
1.8 ADDING ELEMENTS TO EXISTING VARIABLES
vector
DF=1:4
DF(5:10)=10:5:35
AD=[5 7 2]
AD(8)=4 (其它地方补零)
AR(5)=24 (直接赋值的,其它地方直接补零)
matrix
E=[1 2 3 4; 5 6 7 8]
加一行
E(3,:)=[10:4:22]
AW=[3 6 9; 8 5 11]
AW(4,5)=17 (其它地方补零)
BG(3,4)=15 (直接赋值的,其它地方直接补零)
1.9 DELETING ELEMENTS
kt=[2 8 40 65 3 55 23 15 75 80]
kt(6)=[]
kt(3:6)=[]
mtr=[5 78 4 24 9; 4 0 36 60 12; 56 13 5 89 3]
mtr(:,2:4)=[]
1.10 BUILT-IN FUNCTIONS FOR HANDLING ARRAYS
length(A)
size(A)
等等查书和帮助文档
分享到:
相关推荐
Electronically Scanned Arrays_MATLAB Modeling and Simulation 英文高清书籍
Creates two files "filename.h" which defines the size of the array and declares the arrays as extern, and "filename.c" which contains theinstances of the array variable. Appends _B to numerator ...
浅谈matlab与c#混编的文档,环境设置的选择和一般线性规划的求解方法,涉及非线性规划。
利用电磁波的相干原理,通过计算机控制输往天线各阵元电流相位的变化来改变波束的方向,同样可进行扫描,称为电扫描。天线阵,根据扫描情况可分为相扫、频扫、相/相扫、相/频扫、机/相扫、机/频扫、有限扫等多种体制...
Working with Arrays in MATLAB.zip
this code be able to part the n*n array to 4*4 arrays
一本基于matlab的数理统计电子书-Crc Press - Computational Statistics Handbook With Matlab -.part1.rar 希望对大家有所帮助:) Table of Contents Preface Chapter 1 Introduction 1.1 What Is ...
• “Creating and Concatenating Matrices” on page 1-2 • “Matrix Indexing” on page 1-11 • “Getting Information About a Matrix” on page 1-22 • “Resizing and Reshaping Matrices” on page 1-25 •...
Java学习笔记 1 命令行运行 1 Java基础 1 注释 1 单行注释 1 多行注释 1 文档注释 1 标识符和关键字 2 数据类型 4 类型转换 7 变量 9 基本运算符 10 包机制 12 Javadoc 12 使用命令行生成 12 使用idea生成 12 Java...
multidimensional numeric arrays, character arrays, cell arrays, structure arrays and symbolic data type. The remaining chapters discuss respectively numerical computing, symbolic computing, ...
嵌套阵列DOA估计matlab例程,基于Nested Arrays A Novel Approach to Array Processing With Enhanced Degrees of Freedom。
• “How MATLAB Represents Java Arrays” on page 1-21 • “Create Array of Java Objects” on page 1-24 • “Access Elements of Java Array” on page 1-26 • “Assign Values to Java Array” on page 1-31...
JavaSE 星辰学习笔记 简介 如何高效的学习Java 案例:创建一个博客网站typecho 基础 Java程序运行机制 数据类型 变量 变量作用域 常量final 变量的命名规范 运算符 for循环 增强for循环 break continue 练习 Java的...
毕业设计的无线通信题目,使用matlab程序实现无线通信,包括天线阵列,软件无线电, GIHawZ,蓝牙,调制,解调等等,各方面例程及simulink仿真,特别的还有无线通信中的mfgVERT技术,很好的例程代码。
本资源包含了基于互质阵列(Coprime Arrays)的解模糊的联合MUSIC算法的MATLAB程序代码。互质阵列是一种特殊的阵列设计,它利用数学上的互质概念来增加阵列的虚拟孔径,从而提高方向估计(DOA)的分辨率。该资源中的...
天线方向图matlab代码
A.1 What Is MATLAB? A.2 Getting Help in MATLAB A.3 File and Workspace Management A.4 Punctuation in MATLAB A.5 Arithmetic Operators A.6 Data Constructs in MATLAB Basic Data Constructs ...
A.1 What Is MATLAB? A.2 Getting Help in MATLAB A.3 File and Workspace Management A.4 Punctuation in MATLAB A.5 Arithmetic Operators A.6 Data Constructs in MATLAB Basic Data Constructs ...
Gain an in-depth understanding of PHP 7 arrays. After a quick overview of PHP 7, each chapter concentrates on single, multi-dimensional, associative, and object arrays. PHP Arrays is a first of its ...
此资源提供了基于互质阵列(Coprime Arrays)的差分共阵列空间平滑MUSIC算法的MATLAB程序代码。互质阵列是一种稀疏阵列配置,能够通过较少的物理阵元实现高分辨率的方向估计。该资源中的MATLAB代码利用互质阵列的...