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 CenterFile Exchange에서 Sources에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by