Repmat:Replicate and tile an array

Syntax

B = repmat(A,m,n)

B = repmat(A,[m n])

B = repmat(A,[m n p...])

Description

B = repmat(A,m,n) creates a large matrix B consisting of an m-by-n tiling of copies of A. The size of B is [size(A,1)*m, (size(A,2)*n]. The statement repmat(A,n) creates an n-by-n tiling.

B = repmat(A,[m n]) accomplishes the same result as repmat(A,m,n).

B = repmat(A,[m n p...]) produces a multidimensional array B composed of copies of A. The size of B is [size(A,1)*m, size(A,2)*n, size(A,3)*p, ...].

repmat(A,m,n) when A is a scalar, produces an m-by-n matrix filled with A's value and having A's class. For certain values, you can achieve the same results using other functions, as shown by the following examples: repmat(NaN,m,n) returns the same result as NaN(m,n). repmat(single(inf),m,n) is the same as inf(m,n,'single'). repmat(int8(0),m,n) is the same as zeros(m,n,'int8'). repmat(uint32(1),m,n) is the same as ones(m,n,'uint32'). repmat(eps,m,n) is the same as eps(ones(m,n)).

Examples

In this example, repmat replicates 12 copies of the second-order identity matrix, resulting in a "checkerboard" pattern.

B = repmat(eye(2),3,4) %size(eye(2),1) = 2; size(eye(2),2)=2;

B =  %(3*2;4*2;) eye(2)整体向右变为8;向下变为6

1     0     1     0     1     0     1     0

0     1     0     1     0     1     0     1

1     0     1     0     1     0     1     0

0     1     0     1     0     1     0     1

1     0     1     0     1     0     1     0

0     1     0     1     0     1     0     1

The statement N = repmat(NaN,[2 3]) creates a 2-by-3 matrix of NaNs.

Repmat:Replicate and tile an array的更多相关文章

  1. Matlab编程基础

    平台:Win7 64 bit,Matlab R2014a(8.3) “Matlab”是“Matrix Laboratory” 的缩写,中文“矩阵实验室”,是强大的数学工具.本文侧重于Matlab的编程 ...

  2. [Python Cookbook] Numpy: Multiple Ways to Create an Array

    Convert from list Apply np.array() method to convert a list to a numpy array: import numpy as np myl ...

  3. UFLDL实验报告3:Self-taught

    Self-taught 自我学习器实验报告 1.Self-taught 自我学习实验描述 自我学习是无监督特征学习算法,自我学习意味着算法能够从未标注数据中学习,从而使机器学习算法能够获得更大数量的数 ...

  4. K近邻分类算法实现 in Python

    K近邻(KNN):分类算法 * KNN是non-parametric分类器(不做分布形式的假设,直接从数据估计概率密度),是memory-based learning. * KNN不适用于高维数据(c ...

  5. UFLDL实验报告2:Sparse Autoencoder

    Sparse Autoencoder稀疏自编码器实验报告 1.Sparse Autoencoder稀疏自编码器实验描述 自编码神经网络是一种无监督学习算法,它使用了反向传播算法,并让目标值等于输入值, ...

  6. K-近邻算法python实现

    内容主要来源于机器学习实战这本书.加上自己的理解. 1.KNN算法的简单描写叙述 K近期邻(k-Nearest Neighbor.KNN)分类算法能够说是最简单的机器学习算法了. 它採用測量不同特征值 ...

  7. R语言︱分布函数与概率密度+随机数产生

    1.常见概率分布 ##正态分布 pnorm(1.96) #P(x<=1.96)时的分布概率 pnorm(1.96,0,1) #上同 pnorm(1.96,lower.tail = F) #P(x ...

  8. 机器学习之--KNN算法简单实现

    # # kNN 分类算法 a = np.array([[1,1],[1.2,1.5],[0.3,0.4],[0.2,0.5]]) #构造样本数据 labels = ['A','A','B','B'] ...

  9. tensorflow faster rcnn 代码分析一 demo.py

    os.environ["CUDA_VISIBLE_DEVICES"]=2 # 设置使用的GPU tfconfig=tf.ConfigProto(allow_soft_placeme ...

随机推荐

  1. centos7安装MPlyaer

    最近更换了centos7系统,对新系统的操作不是太熟悉.大神轻喷.昨晚突然想要下个电影看看,结果发现系统自带的播放器支持的视频格式有限,google查了一下,他们推荐使用MPlayer.于是经过一通g ...

  2. Spring初学之使用JdbcTemplate

    Spring中使用JdbcTemplate.JdbcDaoSupport和NamedParameterJdbcTemplate来操作数据库,但是JdbcTemplate最常用,最易用. jdbc.pr ...

  3. vijos 1057 盖房子 dp 最大子正方形

    P1057盖房子 未递交 标签:[显示标签] 描述 永恒の灵魂最近得到了面积为n*m的一大块土地(高兴ING^_^),他想在这块土地上建造一所房子,这个房子必须是正方形的. 但是,这块土地并非十全十美 ...

  4. SQL Server 中WITH (NOLOCK)浅析(转)

    概念介绍  开发人员喜欢在SQL脚本中使用WITH(NOLOCK), WITH(NOLOCK)其实是表提示(table_hint)中的一种.它等同于 READUNCOMMITTED . 具体的功能作用 ...

  5. 冒泡排序的PHP实现 Bubble Sort

    冒泡排序Bubble Sort的PHP实现.代码中函数说明: out_arr,用于将数组输出成一个字符串,以便查看 bubblesort,第一种实现方案,从后往前依次选出需要的值,这里是较大的 bub ...

  6. MySQL分片 --转自Peter Zaitsev对MySQL分片的建议

    本文作者Peter Zaitsev是知名数据库专家,2006年联合创立了Percona.负责维护网站“MySQL性能”.同时,他也是<高性能MySQL>一书的联合作者.以下是他对MySQL ...

  7. Rational Rose 2003 下载、破解及安装方法(图文)

    方法一: 1. 安装Rational Rose2003时,在需选择安装项的时候,只选择Rational Rose EnterPrise Edition即可,不需选择其他项,之后选择“DeskTop I ...

  8. C#异步编程(二)用户模式线程同步

    基元线程同步构造 多个线程同时访问共享数据时,线程同步能防止数据损坏.不需要线程同步是最理想的情况,因为线程同步存在许多问题. 第一个问题就是它比较繁琐,而且很容易写错. 第二个问题是,他们会损害性能 ...

  9. C++语言对C的增强(2)—— const增强、枚举的增强

    1.const基础知识 #include <iostream> int main(void) { //const定义常量--->const意味着只读 const int a; int ...

  10. jsp有哪些动作?作用分别是什么?

    jsp共有6种基本动作: 1.jsp:include,在页面被请求的时候引入一个文件 2.jsp:useBean,寻找或者实例化一个JavaBean 3.jsp:setProperty,设置JavaB ...