Why Matlab and Simulink have different Plot for the same modulo function?

2 ビュー (過去 30 日間)
Chenji Tu
Chenji Tu 2021 年 4 月 1 日
コメント済み: Chenji Tu 2021 年 4 月 1 日
Dear community,
as shown in the attached .png, it seems for the same modulo function, the plot from Matlab looks not the same as that from Simulink.
Changing the Solver Settings doesn't make a difference.
Why?

採用された回答

Fangjun Jiang
Fangjun Jiang 2021 年 4 月 1 日
The step size is more important than solver in this case. Reducing the step size to be 1 or 0.5 and making it fixed would resolve the problem.
  2 件のコメント
Steven Lord
Steven Lord 2021 年 4 月 1 日
That's my thought as well. Sometimes the step size is critical in showing what a function truly looks like.
x = 0:10;
plot(x, sinpi(x), 'o-')
Look what happens if we evaluate the function at a few more points.
figure
x2 = 0:0.25:10;
plot(x2, sinpi(x2), 'o-')
Looks a lot more like a sine curve, doesn't it?
Chenji Tu
Chenji Tu 2021 年 4 月 1 日
Thanks a lot for quick feedback. Now I got it.

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

その他の回答 (0 件)

カテゴリ

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

製品


リリース

R2017b

Community Treasure Hunt

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

Start Hunting!

Translated by