How to create a sine function from simulink blocks?

Note: It is not allowed to use sine wave block or similar
I am trying to create a simulink model to reproduce a sine wave Amplitude*sin(2*pi*f*t + angle).
The output must be a sine signal that will be used elsewhere in a simulink model. My attempt doesn't work, I don't know why.
Result:

1 件のコメント

Sebastian
Sebastian 2025 年 5 月 9 日
Hi, you have to use the "Digital Clock" instead of the "Clock". Then you must set the "Sample time" of your "Digital Clock" to a very low value (in my case its 200e-6 seconds). After that, go the "Model Configuration Parameters" and set the "Solver" to "discrete (no continous state) and the "Type" to "Variable-step". After that you get your sine wave with your amplitude and frequency.

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

 採用された回答

Paul
Paul 2023 年 4 月 4 日

0 投票

Why not just use a Sine Wave block? Would be a lot easier, and you can specify the sample time. The plot you're getting is most likely due to the solver settings for the time step.

1 件のコメント

Paul
Paul 2023 年 4 月 4 日
Oh, well if you can't use the Sine Wave block what you have looks fine.
That plot on the scope is probably related to the solver settings. What are the settings on the Solver Pane for the solver and the step size control?

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

その他の回答 (0 件)

カテゴリ

ヘルプ センター および File ExchangeSimulink についてさらに検索

製品

リリース

R2019b

質問済み:

2023 年 4 月 4 日

コメント済み:

2025 年 5 月 9 日

Community Treasure Hunt

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

Start Hunting!

Translated by