change constant block value

12 ビュー (過去 30 日間)
Dindigala Prudhvi Charan
Dindigala Prudhvi Charan 2017 年 10 月 24 日
編集済み: Vincen Lee 2017 年 10 月 25 日
Hello, Can you please look at the below screenshot and help me in simulating my file,
I have specified all parameters like B, C in the workspace and w(omega) and phi(phase difference) values by double-clicking on the blocks itself but the problem is with D2 parameter has a value varying with time. the code I wrote for D2 variation is also attached below but I need help in attaching these values with simulation file

回答 (2 件)

Yanbiao FENG
Yanbiao FENG 2017 年 10 月 24 日
編集済み: Yanbiao FENG 2017 年 10 月 24 日
you can use "from workspace", the D2 is a n*2 matrix, the first column is time, second row is D2 values; that how many rows depends on the time step. For example:
D2=[1 1
2 1
3 1
4 1
5 1.5
6 2
7 2
8 2
9 2];
  1 件のコメント
Dindigala Prudhvi Charan
Dindigala Prudhvi Charan 2017 年 10 月 25 日
編集済み: Dindigala Prudhvi Charan 2017 年 10 月 25 日
I want the time to be the simulation time. As you can see in the .m file there is a variable called tout in 5th line which is supposed to be the simulation running time and also from your method of defining vector of n*2 I am giving discrete values for D2 (i.e at time instants of 1,2,3...10) but I want it to be a continuous variable

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


Vincen Lee
Vincen Lee 2017 年 10 月 25 日
編集済み: Vincen Lee 2017 年 10 月 25 日
Try Matlab Function block in Simulink/User-Defined Functions.
You can write your code for generating D2 in Matlab Function block. The input is the Clock block from Simulink/Sources. The output is D2.
Hope it helps.

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by