永发信息网

matlab 中mod的用法

答案:1  悬赏:80  手机版
解决时间 2021-02-23 03:40
matlab 中mod的用法
最佳答案
简单的说mod(a,b)就是求的是a除以b的余数。比方说mod(100,3)=1,mod(17,6)=5
详细用法见下

mod

Modulus after division

Syntax

M = mod(X,Y)

Description

M = mod(X,Y) if Y ~= 0, returns X - n.*Y where n = floor(X./Y). If Y is not an integer and the quotient X./Y is within roundoff error of an integer, then n is that integer. The inputs X and Y must be real arrays of the same size, or real scalars.

The following are true by convention: mod(X,0) is X mod(X,X) is 0 mod(X,Y) for X~=Y and Y~=0 has the same sign as Y.

Remarks

rem(X,Y) for X~=Y and Y~=0 has the same sign as X.

mod(X,Y) and rem(X,Y) are equal if X and Y have the same sign, but differ by Y if X and Y have different signs.

The mod function is useful for congruence relationships: x and y are congruent (mod m) if and only if mod(x,m) == mod(y,m).

Examples

mod(13,5)
ans =
3

mod([1:5],3)
ans =
1 2 0 1 2

mod(magic(3),3)
ans =
2 1 0
0 2 1
1 0 2
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
制取Na₂CO₃NaOH+CO₂→NaHC
在明年毕业之前想做旅游体验师,需要做哪些准
速尔快递在哪里啊,我有事要去这个地方
【家字开头的成语】以“家”字开头的四字成语
师承和确有专长中医执业助理技能考试现考不考
驱动更新后电脑分辨率超低,看不清字,该怎么
御坊堂养生馆我想知道这个在什么地方
安卓手机在玩qq语音时,有没有可以把双方语音
毒霸监测显示:浏览网页时域名解析不正常、ht
上海属于“民用建筑热工设计规范”(GB、5017
北京星火燎原软件有限公司恩施办事处地址有知
吴亦凡得 all of me 歌词
建设一路/马元路(路口)在哪里啊,我有事要去
光明城钟表眼镜地址在哪,我要去那里办事
睡前一根烟后面是什么句子显的好
推荐资讯
数码大师如何注册
苹果售后需要apple id吗
洪瑞超市地址在什么地方,想过去办事
有哪些好玩的游戏?
有载变压器的35KV分接开关没有卡到正确位置(
火星刑冥王星
如何将QQ消息管理器中的“已删除联系人”人员
园林植物与观赏园艺博士点
3厘米3毫米+70毫米=()厘米()毫米
【distracting the very young children can
我的华为帐号密码改了忘记了,手机号注册的,
名创优品大石街店这个地址在什么地方,我要处
正方形一边上任一点到这个正方形两条对角线的
阴历怎么看 ?