フィルターのクリア

Simulink From Workspace Block

1 回表示 (過去 30 日間)
Nuh Metehan
Nuh Metehan 2014 年 2 月 5 日
コメント済み: Azzi Abdelmalek 2014 年 2 月 5 日
Hello I need a help,
I would like to define a Simulink input which is Sample time dependent.
For an instance; I defined a time variable-function in matlab editor and want to get values at each time step at Simulink input gate.. So i am a little bit confused how to determine this block in simulink. I think i need to used from workspace block but how to express variables ?
Can someone answer in a detailed way ?

回答 (1 件)

Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 5 日
編集済み: Azzi Abdelmalek 2014 年 2 月 5 日
Example with from file block
ts=1 % your sample time
t=0:ts:100*ts % your time vector
y=sin(t) % your signal
ty=[t;y];
save FileName ty % FileName is the name of your mat-file where your signal will be saved
In Simulink set the file name to: FileName
If you want to use a from workspace block, create a variable
ts=1 % your sample time
t=0:ts:100*ts % your time vector
y=sin(t) % your signal
ty=[t;y];
ty=ty'
Then set the variable name in your block to ty and a sample time to ts.
You can also define your variable as a timeseries with from workspace block
N = 100; % number of samples
Ts = 1; % sample time
t = ((0:N)* Ts)'; % time vector
y = sin(t); % your signal
your_signal = timeseries(y,t)
Then set a variable name in your block to your_signal
  1 件のコメント
Azzi Abdelmalek
Azzi Abdelmalek 2014 年 2 月 5 日
Nuh commented
Thanx it was really helpful ;))

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

カテゴリ

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

Community Treasure Hunt

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

Start Hunting!

Translated by