How to get the remainder of a division in Simulink?

46 ビュー (過去 30 日間)
Paulo Melo
Paulo Melo 2011 年 5 月 11 日
コメント済み: Suyash Jadhav 2024 年 7 月 2 日
Hi!
How can I get the remainder of a division in simulink (similar to the rem function of matlab)? thanks, paulo
  1 件のコメント
Suyash Jadhav
Suyash Jadhav 2024 年 7 月 2 日
You can use the formula-
Rem= number to divide- floor(Quotient*Divisor)
This can be constructed in simulink.

サインインしてコメントする。

採用された回答

Guy Rouleau
Guy Rouleau 2011 年 5 月 12 日
Use the "rem" option of the Math Function block:
@ Paulo Silva: Using the MATLAB Function block for that is like hunting squirrels with a tank... it works, but it's not the most convenient solution.

その他の回答 (3 件)

Paulo Silva
Paulo Silva 2011 年 5 月 11 日
in1---->|MUX|---->|Matlab Fcn |--->out
in2---->| | |u(1) - fix(u(1)./u(2)).*u(2)|
or
in1---->|MUX|---->|Matlab Fcn |--->out
in2---->| | |rem(u(1),u(2))|
or even better (found this one now)
Use the Math Function from the Math Operations and choose the rem function!

Paulo Melo
Paulo Melo 2011 年 5 月 12 日
Thanks for both answers! In my case, Paulo Silva's answer didn't work since in my model I can't use Fcns, but Guy's answer worked out ok.

Arjunkrishna Mitta
Arjunkrishna Mitta 2021 年 8 月 20 日
We can also use the math operator and in drop down select the mod operator and you can get the remainder in simulink.
Just click on blank space and type mod you will get the block required

カテゴリ

Help Center および File ExchangeGeneral Applications についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by