Simple Matlab/Simulink Model, adding 2 signals -


i have created simple simulink model adds 2 signals: simulink model

the code control model following:

clear x y result  data=ones(1,5); x=timeseries(data); y=timeseries(data);  output = sim('model_test','stoptime',stop_time); result = output.get('res'); 

obviously, wish following result, matrix containing [2 2 2 2 2]. however, result looks this: simulink result

result 1x1x27 double , not 1x5 double hoped for. know have change? code wrong or have change settings in simulink model? thank in advance!

the problem how constructing input data.

the syntax using timeseries constructs x , y such have scalar value of 2 @ time equal 0,1,2,3 , 4 seconds. can see looking @ x.time , x.data.

from expecting looks wanting define them being 5 element vectors @ each time step. involve using

>> x = timeseries(ones(1,5),0); 

or similar depending on how many time points want define. above defines data @ time = 0 seconds. again, @ variable in matlab workspace confirm this. (of course if intent having same value @ every time step should use constant block not workspace block.)

the output (as input) displayed 3d matrix because third dimension time. every simulation time step model takes have signal value. in model scalar, in general will/can 2d matrix. 1x1x27 result because signals scalar (the 1x1 bit) , 27 time steps taken (the x27 bit).


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -