zoukankan      html  css  js  c++  java
  • Repmat:Replicate and tile an array

    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.

  • 相关阅读:
    第3.2 使用案例1:股票期货stock portfolio 21050917
    颜色代码表#FFFFFF #FF0000 #00FF00 #FF00FF (2015-07-21 10:39)转载
    JSTL(1.1)的配置
    Ext JS 4 老特征:statics 静态的变量和方法
    Ext JS 4 新特性2:配置项属性(config)之二
    Ext JS 4 新特性2:配置项属性(config)之一
    JS 4 新特性:混合属性(mixins)之二
    JS 4 新特性:混合属性(mixins)
    校验LocalDate格式
    java 执行js的eval方法
  • 原文地址:https://www.cnblogs.com/qqhfeng/p/5110680.html
Copyright © 2011-2022 走看看