matlab整形移位,[转载]Matlab的两种移位运算

本文介绍了Matlab中的两种移位运算:circshift用于矩阵的循环移位,例如将矩阵第一维元素向下移位1;而bitshift则进行位移位,支持正负位移,可用于数值的乘方或除方运算。通过示例展示了两种移位运算的具体使用方法。
摘要由CSDN通过智能技术生成

Matlab的两种移位运算:

1) circshift 矩阵移位

circshift :Shift array circularly

Syntax : B = circshift(A,shiftsize)

Description :

B = circshift(A,shiftsize) circularly shifts

the values in the array, A, by shiftsize elements. shiftsize is a

vector of integer scalars where the n-th element specifies the

shift amount for the n-th dimension of array A. If an element in

shiftsize is positive, the values of A are shifted down (or to the

right). If it is negative, the values of A are shifted up (or to

the left). If it is 0, the values in that dimension are not

shifted.

Example :

Circularly shift first dimension values down by 1.

A = [ 1 2 3;4 5 6; 7 8 9]

A =

1 2 3

4 5 6

7 8 9

B = circshift(A,1)

B =

7 8 9

1 2 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值