matlab矩阵的乘方,矩阵元素的乘方

>> help repmat

REPMAT Replicate and tile an array.

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 ...]) tiles the array A to produce 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 is commonly used to produce an M-by-N

matrix filled with A's value and having A's CLASS. For certain values,

you may achieve the same results using other functions. Namely,

REPMAT(NAN,M,N)           is the same 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))

Example:

repmat(magic(2), 2, 3)

repmat(uint8(5), 2, 3)

Class support for input A:

float: double, single

See also bsxfun, meshgrid, ones, zeros, nan, inf.

>> A = [1,2,3];

>> A = repmat(A,[3,1])

A =

1     2     3

1     2     3

1     2     3

>> B = [1;2;3];

>> B = repmat(B,[1,3])

B =

1     1     1

2     2     2

3     3     3

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值