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. [kuangbin带你飞]专题十 匹配问题 一般图匹配

    过去做的都是二分图匹配 即 同一个集合里的点 互相不联通 但是如果延伸到一般图上去 求一个一般图的最大匹配 就要用带花树来解决 带花树模板 用来处理一个无向图上的最大匹配 看了一会还是不懂  抄了一遍 ...

  2. 可编辑的div模仿文本框缓存(使用AUTOCOMPLETE属性,off是不缓存,on是缓存(默认))

    用session实现的, 1.进当前页面就从session(a)中取( sessionStorage.getItem )(不管存在不存在,后续有合理的存储和删除); 2.离开当前页时删除这个sessi ...

  3. Codeforces Round #283 (Div. 2) A ,B ,C 暴力,暴力,暴力

    A. Minimum Difficulty time limit per test 2 seconds memory limit per test 256 megabytes input standa ...

  4. DelphiXE_Android

    1. http://download.csdn.net/detail/gx15941883020/8104761 2. http://bbs.2ccc.com/topic.asp?topicid=45 ...

  5. 判断一个浏览器是否支持opacity

    支持opacity的浏览器,总会将opacity值规范成小于1.0且以0开头的值.例如,如果将opacity指定为:.5,原始支持opacity的浏览器就会将该值规范为0.5,而不支持opacity的 ...

  6. review38

    Java程序中可以存在多个线程,但是在处理多线程问题时,必须注意这样一个问题:当两个或多个线程同时访问同一个变量,并且一些线程需要修改这个变量.这时可能发生混乱. 所谓线程同步就是若干个线程都需要一个 ...

  7. java: InputStreamReader将字节的输入流变成字符的输入流,OutputStreamWriter将字符的输出流变成字节的输出流

    InputStreamReader:将字节的输入流变成字符的输入流, OutputStreamWriter:将字符的输出流变成字节的输出流 //将缓冲区的内容读取,可以一次读取 //可以接收键盘的输入 ...

  8. 解决PasswordBox的Password非依赖属性,而无法绑定的问题,以及常规命令如何使用

    http://stackoverflow.com/questions/1483892/how-to-bind-to-a-passwordbox-in-mvvm

  9. Linux 性能监控分析

    好文,参考 http://blog.csdn.net/hexieshangwang/article/details/47187185

  10. JVM_总结_00_资源帖

    一.官方资料 Java Platform Standard Edition 8 Documentation The Java™ Tutorials Java 8 API 二.精选资料 发布<Ja ...