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.
Repmat:Replicate and tile an array的更多相关文章
- Matlab编程基础
平台:Win7 64 bit,Matlab R2014a(8.3) “Matlab”是“Matrix Laboratory” 的缩写,中文“矩阵实验室”,是强大的数学工具.本文侧重于Matlab的编程 ...
- [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 ...
- UFLDL实验报告3:Self-taught
Self-taught 自我学习器实验报告 1.Self-taught 自我学习实验描述 自我学习是无监督特征学习算法,自我学习意味着算法能够从未标注数据中学习,从而使机器学习算法能够获得更大数量的数 ...
- K近邻分类算法实现 in Python
K近邻(KNN):分类算法 * KNN是non-parametric分类器(不做分布形式的假设,直接从数据估计概率密度),是memory-based learning. * KNN不适用于高维数据(c ...
- UFLDL实验报告2:Sparse Autoencoder
Sparse Autoencoder稀疏自编码器实验报告 1.Sparse Autoencoder稀疏自编码器实验描述 自编码神经网络是一种无监督学习算法,它使用了反向传播算法,并让目标值等于输入值, ...
- K-近邻算法python实现
内容主要来源于机器学习实战这本书.加上自己的理解. 1.KNN算法的简单描写叙述 K近期邻(k-Nearest Neighbor.KNN)分类算法能够说是最简单的机器学习算法了. 它採用測量不同特征值 ...
- R语言︱分布函数与概率密度+随机数产生
1.常见概率分布 ##正态分布 pnorm(1.96) #P(x<=1.96)时的分布概率 pnorm(1.96,0,1) #上同 pnorm(1.96,lower.tail = F) #P(x ...
- 机器学习之--KNN算法简单实现
# # kNN 分类算法 a = np.array([[1,1],[1.2,1.5],[0.3,0.4],[0.2,0.5]]) #构造样本数据 labels = ['A','A','B','B'] ...
- tensorflow faster rcnn 代码分析一 demo.py
os.environ["CUDA_VISIBLE_DEVICES"]=2 # 设置使用的GPU tfconfig=tf.ConfigProto(allow_soft_placeme ...
随机推荐
- js轮训
Later.js,一个独立的JavaScript类库,提供了循环事件触发的高级应用,可以为项目替换以上两种方法. 通常,我们要完成复杂的时间预定,需要大量的if...else语句.Later.js提供 ...
- python3 列表属性
1.合并 >>> l1=[1,2,3,'e']>>> l2=['f',34,'feel']>>> l1+l2[1, 2, 3, 'e', 'f', ...
- Python中的Unicode编码和UTF-8编码
下午看廖雪峰的Python2.7教程,看到 字符串和编码 一节,有一点感受,结合崔庆才的Python博客 ,把这种感受记录下来: ASCII码:是用一个字节(8bit, 0-255)中的127个字母表 ...
- 用createinstallmedia创建可恢复的OSX安装DMG
准备 从App Store下载OS X安装程序,下载完成,会在应用程序目录 /Applications 下找到类似 Install OS X 10.xxxxxx.app(中文名如:安装 OS X 10 ...
- Spring boot临时文件目录报错
基本的错误信息如下: 2018-03-05 at 15:12:03 CST ERROR org.apache.juli.logging.DirectJDKLog 181 log - Servlet.s ...
- linux IP局域网监控工具——iptraf
iptraf iptraf是一款交互式.色彩鲜艳的IP局域网监控工具.它可以显示每个连接以及主机之间传输的数据量.下面是屏幕截图. $ sudo iptraf 安装iptraf: # Centos(基 ...
- vue项目组件的全局注册
在vue-cli项目中,我们经常会封装自己的组件,并且要在多个界面中引用它,这个时候就需要全局注册组件. 首先我们会封装自己的组件,比如twoDimensionTable文件夹下的index.vue: ...
- mysql查询哪张表数据最大
转载:https://blog.csdn.net/qq13650793239/article/details/81142134 mysql数据库中information_schema 数据库存储了数据 ...
- 一些神奇的(优化)板子——来自Loi_black的博客
deque<int>q; void spfa(int s) { ;i<=n;i++) d[i]=1e9; d[s]=; q.push_back(s); used[s]=; while ...
- mysql定时任务备份bat命令-记录一下待日后使用
最近有个任务,需要每日备份数据库到某个磁盘,使用window定时任务调用bat文件实现. %Date:~0,2%获取星期几,这个要根据系统进行尝试, 有 星期几 7/25/2018 有 2018/ ...