MATLAB Answers

Generating discrete values in simulink

6 ビュー (過去 30 日間)
Najmeh Eskandari
Najmeh Eskandari 2018 年 5 月 21 日
コメント済み: Majid Farzaneh 2018 年 5 月 21 日
Hello. I want to generate this signal in Simulink: c=0:.001:1; h=3; x_0=0; x_d=x_0 + h*(c-sin(2*pi*c)/(2*pi)); but I don't know how can I generate c in Simulink?

  0 件のコメント

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

採用された回答

Majid Farzaneh
Majid Farzaneh 2018 年 5 月 21 日
Hi, You can use Constant block and set the constant value to 0:0.001:1 but if c is time for you and you want to show the output on scope you can use a clock block for c like this:

  3 件のコメント

Najmeh Eskandari
Najmeh Eskandari 2018 年 5 月 21 日
Thanks so much. why should I use clock instead of constant? c is discrete time. how can I display it?
Majid Farzaneh
Majid Farzaneh 2018 年 5 月 21 日
Every signal is discrete in computer. Continues signals have infinite points and need infinite storage and we have not infinite storages. You can use 'to workspace' block instead of scope. The result will be saved in workspace and you can use plot command etc to show the result as discrete or continues.
Majid Farzaneh
Majid Farzaneh 2018 年 5 月 21 日
If your increment value (0.001) is important for you, you can use 'Digital Clock' and set the Sample Time to '0.001' and set the simulation time to 1. So you have 0:0.001:1 for clock.

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

その他の回答 (0 件)

Community Treasure Hunt

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

Start Hunting!

Translated by